nilfs2: reject invalid file types when reading inodes
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Thu, 10 Jul 2025 13:49:08 +0000 (22:49 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 20 Jul 2025 02:26:16 +0000 (19:26 -0700)
commit4aead50caf67e01020c8be1945c3201e8a972a27
tree3776af94f91a5512b33ca9789c1844c07e3ffe55
parent7563fcbfd484b347b776aeed4d7dac78b30884aa
nilfs2: reject invalid file types when reading inodes

To prevent inodes with invalid file types from tripping through the vfs
and causing malfunctions or assertion failures, add a missing sanity check
when reading an inode from a block device.  If the file type is not valid,
treat it as a filesystem error.

Link: https://lkml.kernel.org/r/20250710134952.29862-1-konishi.ryusuke@gmail.com
Fixes: 05fe58fdc10d ("nilfs2: inode operations")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/nilfs2/inode.c