linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir
@ 2016-04-27 12:32 Yunlong Song
  2016-04-27 13:25 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yunlong Song @ 2016-04-27 12:32 UTC (permalink / raw)
  To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song
  Cc: bintian.wang, houpengyang, heyunlei, liushuoran, shiguojun,
	linux-f2fs-devel, linux-kernel

Commit 57b62d29ad5b384775974973087d47755a8c6fcc ("f2fs: fix to report
error in f2fs_readdir") causes f2fs_readdir to return -ENOENT when
get_lock_data_page returns -ENOENT. However, the original logic is to
continue when get_lock_data_page returns -ENOENT, but it forgets to
reset err to 0.

This will cause getdents64 incorretly return -ENOENT when lastdirent is
NULL in getdents64. This will lead to a wrong return value for syscall
caller.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/dir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 0ad7b9a..3ed6145 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -886,6 +886,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 		kunmap(dentry_page);
 		f2fs_put_page(dentry_page, 1);
 	}
+	err = 0;
 out:
 	fscrypt_fname_free_buffer(&fstr);
 	return err;
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir
  2016-04-27 12:32 [PATCH] f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir Yunlong Song
@ 2016-04-27 13:25 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2016-04-27 13:25 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, cm224.lee, yuchao0, sylinux
  Cc: bintian.wang, houpengyang, heyunlei, liushuoran, shiguojun,
	linux-f2fs-devel, linux-kernel

On 2016/4/27 20:32, Yunlong Song wrote:
> Commit 57b62d29ad5b384775974973087d47755a8c6fcc ("f2fs: fix to report
> error in f2fs_readdir") causes f2fs_readdir to return -ENOENT when
> get_lock_data_page returns -ENOENT. However, the original logic is to
> continue when get_lock_data_page returns -ENOENT, but it forgets to
> reset err to 0.
> 
> This will cause getdents64 incorretly return -ENOENT when lastdirent is
> NULL in getdents64. This will lead to a wrong return value for syscall
> caller.
> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-27 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 12:32 [PATCH] f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir Yunlong Song
2016-04-27 13:25 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).