ANDROID: sdcardfs: Fix incorrect hash
authorDaniel Rosenberg <drosen@google.com>
Wed, 15 Feb 2017 04:47:17 +0000 (20:47 -0800)
committerStricted <info@stricted.net>
Thu, 11 Oct 2018 16:03:24 +0000 (18:03 +0200)
This adds back the hash calculation removed as part of
the previous patch, as it is in fact necessary.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35307857
Change-Id: Ie607332bcf2c5d2efdf924e4060ef3f576bf25dc

fs/sdcardfs/lookup.c

index 3a2558b7463b96e66d790d29287c652938b9f13f..87b47e34d80d4aea662bafc5918f63dd2daa8fcd 100644 (file)
@@ -221,6 +221,7 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
        struct dentry *lower_dentry;
        const struct qstr *name;
        struct path lower_path;
+       struct qstr dname;
        struct sdcardfs_sb_info *sbi;
 
        sbi = SDCARDFS_SB(dentry->d_sb);
@@ -306,11 +307,14 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
                goto out;
 
        /* instatiate a new negative dentry */
-       lower_dentry = d_lookup(lower_dir_dentry, name);
+       dname.name = name->name;
+       dname.len = name->len;
+       dname.hash = full_name_hash(dname.name, dname.len);
+       lower_dentry = d_lookup(lower_dir_dentry, &dname);
        if (lower_dentry)
                goto setup_lower;
 
-       lower_dentry = d_alloc(lower_dir_dentry, name);
+       lower_dentry = d_alloc(lower_dir_dentry, &dname);
        if (!lower_dentry) {
                err = -ENOMEM;
                goto out;