]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nilfs2: fix missing cleanup on rollforward recovery error
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Sat, 10 Aug 2024 06:52:42 +0000 (15:52 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:51:42 +0000 (17:51 -0700)
commite2d2ffd7c5ba59e5fff336477ea1bc2d3cfbdf98
tree39120b80f2950bee9b9d5cc6bdded83174a1298b
parent0e6ad98db7bd072801aa286e5d37081524e7b620
nilfs2: fix missing cleanup on rollforward recovery error

In an error injection test of a routine for mount-time recovery, KASAN
found a use-after-free bug.

It turned out that if data recovery was performed using partial logs
created by dsync writes, but an error occurred before starting the log
writer to create a recovered checkpoint, the inodes whose data had been
recovered were left in the ns_dirty_files list of the nilfs object and
were not freed.

Fix this issue by cleaning up inodes that have read the recovery data if
the recovery routine fails midway before the log writer starts.

Link: https://lkml.kernel.org/r/20240810065242.3701-1-konishi.ryusuke@gmail.com
Fixes: 0f3e1c7f23f8 ("nilfs2: recovery functions")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/nilfs2/recovery.c