]> 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>
Mon, 2 Sep 2024 00:59:00 +0000 (17:59 -0700)
commit5787fcaab9eb5930f5378d6a1dd03d916d146622
tree529b6911e15d935e85cbbb475b9bb5bf66ce0b1b
parent683408258917541bdb294cd717c210a04381931e
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