linux-stable/fs/nilfs2
Ryusuke Konishi b14e7260bb nilfs2: protect references to superblock parameters exposed in sysfs
[ Upstream commit 6834082589 ]

The superblock buffers of nilfs2 can not only be overwritten at runtime
for modifications/repairs, but they are also regularly swapped, replaced
during resizing, and even abandoned when degrading to one side due to
backing device issues.  So, accessing them requires mutual exclusion using
the reader/writer semaphore "nilfs->ns_sem".

Some sysfs attribute show methods read this superblock buffer without the
necessary mutual exclusion, which can cause problems with pointer
dereferencing and memory access, so fix it.

Link: https://lkml.kernel.org/r/20240811100320.9913-1-konishi.ryusuke@gmail.com
Fixes: da7141fb78 ("nilfs2: add /sys/fs/nilfs2/<device> group")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:07:52 +02:00
..
alloc.c nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-18 13:07:36 +02:00
alloc.h nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-18 13:07:36 +02:00
bmap.c
bmap.h
btnode.c nilfs2: handle inconsistent state in nilfs_btnode_create_block() 2024-08-19 05:45:22 +02:00
btnode.h
btree.c nilfs2: handle inconsistent state in nilfs_btnode_create_block() 2024-08-19 05:45:22 +02:00
btree.h
cpfile.c
cpfile.h
dat.c nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-18 13:07:36 +02:00
dat.h
dir.c nilfs2: fix kernel bug on rename operation of broken directory 2024-07-18 13:07:43 +02:00
direct.c
direct.h
export.h
file.c
gcinode.c
ifile.c nilfs2: fix incorrect inode allocation from reserved inodes 2024-07-18 13:07:36 +02:00
ifile.h
inode.c
ioctl.c nilfs2: fix out-of-range warning 2024-06-16 13:39:16 +02:00
Kconfig
Makefile
mdt.c
mdt.h
namei.c
nilfs.h nilfs2: add missing check for inode numbers on directory entries 2024-07-18 13:07:32 +02:00
page.c
page.h
recovery.c nilfs2: fix missing cleanup on rollforward recovery error 2024-09-12 11:07:44 +02:00
segbuf.c
segbuf.h
segment.c nilfs2: fix state management in error path of log writing function 2024-09-12 11:07:44 +02:00
segment.h
sufile.c
sufile.h
super.c
sysfs.c nilfs2: protect references to superblock parameters exposed in sysfs 2024-09-12 11:07:52 +02:00
sysfs.h
the_nilfs.c nilfs2: fix inode number range checks 2024-07-18 13:07:32 +02:00
the_nilfs.h nilfs2: fix inode number range checks 2024-07-18 13:07:32 +02:00