]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nilfs2: protect references to superblock parameters exposed in sysfs
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Sun, 11 Aug 2024 10:03:20 +0000 (19:03 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:51:42 +0000 (17:51 -0700)
commit0e6ad98db7bd072801aa286e5d37081524e7b620
treedab984c532885ce38d0783cc8683170be53deed0
parent20a66fb71446ea0657089a6b35c70f0609dc9266
nilfs2: protect references to superblock parameters exposed in sysfs

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: da7141fb78db ("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>
fs/nilfs2/sysfs.c