Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470120 > unrolled thread

[f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket

Started byShuoran Liu <liushuoran@huawei.com>
First post2016-08-25 14:50 +0200
Last post2016-08-25 16:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket Shuoran Liu <liushuoran@huawei.com> - 2016-08-25 14:50 +0200
    Re: [f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate  dentry bucket Chao Yu <chao@kernel.org> - 2016-08-25 16:20 +0200

#1470120 — [f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket

FromShuoran Liu <liushuoran@huawei.com>
Date2016-08-25 14:50 +0200
Subject[f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket
Message-ID<sa2gx-11v-19@gated-at.bofh.it>
In the following scenario,

1) we don't have the key and doing a lookup for encrypted file,
2) and the encrypted filename is big name

we should use fname->hash as name hash value instead of what is
calculated by fname->disk_name. Because in such case,
fname->disk_name is empty.
---
 fs/f2fs/dir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 9054aea..b3e6f7f 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -172,7 +172,10 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
 	int max_slots;
 	f2fs_hash_t namehash;
 
-	namehash = f2fs_dentry_hash(&name);
+	if(fname->hash)
+		namehash = cpu_to_le32(fname->hash);
+	else
+		namehash = f2fs_dentry_hash(&name);
 
 	nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level);
 	nblock = bucket_blocks(level);
-- 
1.9.1

[toc] | [next] | [standalone]


#1470179 — Re: [f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket

FromChao Yu <chao@kernel.org>
Date2016-08-25 16:20 +0200
SubjectRe: [f2fs-dev] [PATCH] f2fs: fix a bug when using namehash to locate dentry bucket
Message-ID<sa3FD-204-11@gated-at.bofh.it>
In reply to#1470120
On 2016/8/25 20:42, Shuoran Liu wrote:
> In the following scenario,
> 
> 1) we don't have the key and doing a lookup for encrypted file,
> 2) and the encrypted filename is big name
> 
> we should use fname->hash as name hash value instead of what is
> calculated by fname->disk_name. Because in such case,
> fname->disk_name is empty.

Your signiture is missing here.

Anyway that's a good catch!

Acked-by: Chao Yu <yuchao0@huawei.com>

> ---
>  fs/f2fs/dir.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index 9054aea..b3e6f7f 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -172,7 +172,10 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
>  	int max_slots;
>  	f2fs_hash_t namehash;
>  
> -	namehash = f2fs_dentry_hash(&name);
> +	if(fname->hash)
> +		namehash = cpu_to_le32(fname->hash);
> +	else
> +		namehash = f2fs_dentry_hash(&name);
>  
>  	nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level);
>  	nblock = bucket_blocks(level);
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web