linux/fs/nilfs2
Ryusuke Konishi 08cfa12adf nilfs2: propagate directory read errors from nilfs_find_entry()
Syzbot reported that a task hang occurs in vcs_open() during a fuzzing
test for nilfs2.

The root cause of this problem is that in nilfs_find_entry(), which
searches for directory entries, ignores errors when loading a directory
page/folio via nilfs_get_folio() fails.

If the filesystem images is corrupted, and the i_size of the directory
inode is large, and the directory page/folio is successfully read but
fails the sanity check, for example when it is zero-filled,
nilfs_check_folio() may continue to spit out error messages in bursts.

Fix this issue by propagating the error to the callers when loading a
page/folio fails in nilfs_find_entry().

The current interface of nilfs_find_entry() and its callers is outdated
and cannot propagate error codes such as -EIO and -ENOMEM returned via
nilfs_find_entry(), so fix it together.

Link: https://lkml.kernel.org/r/20241004033640.6841-1-konishi.ryusuke@gmail.com
Fixes: 2ba466d74e ("nilfs2: directory entry operations")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: Lizhi Xu <lizhi.xu@windriver.com>
Closes: https://lkml.kernel.org/r/20240927013806.3577931-1-lizhi.xu@windriver.com
Reported-by: syzbot+8a192e8d090fa9a31135@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8a192e8d090fa9a31135
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-10-17 00:28:06 -07:00
..
alloc.c nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-03 19:30:16 -07:00
alloc.h nilfs2: fix incorrect kernel-doc declaration of nilfs_palloc_req structure 2024-09-01 20:43:36 -07:00
bmap.c nilfs2: fix missing initial short descriptions of kernel-doc comments 2024-09-01 20:43:37 -07:00
bmap.h nilfs2: use the BITS_PER_LONG macro 2024-09-01 20:43:42 -07:00
btnode.c nilfs2: improve kernel-doc comments for b-tree node helpers 2024-09-01 20:43:36 -07:00
btnode.h fs/nilfs2: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:33 -06:00
btree.c nilfs2: fix potential oob read in nilfs_btree_check_delete() 2024-09-09 16:47:42 -07:00
btree.h nilfs2: add missing description of nilfs_btree_path structure 2024-09-01 20:43:36 -07:00
cpfile.c nilfs2: treat missing cpfile header block as metadata corruption 2024-09-01 20:43:39 -07:00
cpfile.h nilfs2: remove nilfs_cpfile_{get,put}_checkpoint() 2024-02-22 15:38:53 -08:00
dat.c nilfs2: fix missing initial short descriptions of kernel-doc comments 2024-09-01 20:43:37 -07:00
dat.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
dir.c nilfs2: propagate directory read errors from nilfs_find_entry() 2024-10-17 00:28:06 -07:00
direct.c nilfs2: fix failure to detect DAT corruption in btree and direct mappings 2024-03-14 09:17:29 -07:00
direct.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
export.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c nilfs2: fix hang in nilfs_lookup_dirty_data_buffers() 2024-02-07 21:20:36 -08:00
gcinode.c nilfs2: add kernel-doc comments to nilfs_remove_all_gcinodes() 2024-04-25 21:07:08 -07:00
ifile.c nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-03 19:30:16 -07:00
ifile.h nilfs2: localize highmem mapping for checkpoint reading within cpfile 2024-02-22 15:38:53 -08:00
inode.c Many singleton patches - please see the various changelogs for details. 2024-09-21 08:20:50 -07:00
ioctl.c nilfs2: add missing argument descriptions for ioctl-related helpers 2024-09-01 20:43:35 -07:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mdt.c nilfs2: do not output warnings when clearing dirty buffers 2024-09-01 20:43:35 -07:00
mdt.h nilfs2: fix lockdep warnings during disk space reclamation 2022-04-01 11:46:09 -07:00
namei.c nilfs2: propagate directory read errors from nilfs_find_entry() 2024-10-17 00:28:06 -07:00
nilfs.h nilfs2: propagate directory read errors from nilfs_find_entry() 2024-10-17 00:28:06 -07:00
page.c nilfs2: remove duplicate 'unlikely()' usage 2024-09-09 16:47:42 -07:00
page.h nilfs2: do not output warnings when clearing dirty buffers 2024-09-01 20:43:35 -07:00
recovery.c Many singleton patches - please see the various changelogs for details. 2024-09-21 08:20:50 -07:00
segbuf.c nilfs2: convert segment buffer to use kmap_local 2024-02-22 15:38:53 -08:00
segbuf.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
segment.c Many singleton patches - please see the various changelogs for details. 2024-09-21 08:20:50 -07:00
segment.h nilfs2: use kthread_create and kthread_stop for the log writer thread 2024-09-01 20:43:44 -07:00
sufile.c nilfs2: do not propagate ENOENT error from nilfs_sufile_mark_dirty() 2024-09-01 20:43:40 -07:00
sufile.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
super.c nilfs2: separate inode type information from i_state field 2024-09-01 20:43:43 -07:00
sysfs.c nilfs2: protect references to superblock parameters exposed in sysfs 2024-09-01 17:59:00 -07:00
sysfs.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
the_nilfs.c nilfs2: eliminate the shared counter and spinlock for i_generation 2024-09-01 20:43:43 -07:00
the_nilfs.h nilfs2: eliminate the shared counter and spinlock for i_generation 2024-09-01 20:43:43 -07:00