[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1461629220-16280-7-git-send-email-jaegeuk@kernel.org>
Date: Mon, 25 Apr 2016 17:07:00 -0700
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@...nel.org>, He YunLei <heyunlei@...wei.com>
Subject: [PATCH 7/7] f2fs: should check the remaining dentry bits
Let's consider a race condition between f2fs_add_regular_entry and
find_target_dentry.
1.
- f2fs_add_regular_entry updated len: 24 first.
|
Bits: 0 0 0 1
Lens: 24 0 0 3 (name: foo)
|->
- find_target_dentry checks the first bit to find "foo", then ++pointer.
2.
- f2fs_add_regular_entry updates bits.
|>|>|
Bits: 1 1 1 1
Lens: 24 0 0 3 (name: foo)
|
- find_target_dentry is checking second bit, but it's len is zero, which
makes the process being terminated.
In this case, user can add additional dentry named "foo" accordingly.
This patch enables to check the remaining bits.
Signed-off-by: He YunLei <heyunlei@...wei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
---
fs/f2fs/dir.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index e90380d..aed5e6d 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -149,9 +149,9 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname,
/* remain bug on condition */
if (unlikely(!de->name_len))
- d->max = -1;
-
- bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len));
+ bit_pos++;
+ else
+ bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len));
}
de = NULL;
--
2.6.3
Powered by blists - more mailing lists