]> git.itanic.dy.fi Git - linux-stable/commit
nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key()
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Sat, 13 May 2023 10:24:28 +0000 (19:24 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jun 2023 13:45:37 +0000 (15:45 +0200)
commit902fcec05295a66370f7b15822243d7898bf7b46
tree0d2ba913d699bc74b86a27ed43901ee60b4a0f67
parentd59293f082dcccef2208716bcf95ce6b8de5341d
nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key()

commit 2f012f2baca140c488e43d27a374029c1e59098d upstream.

A syzbot fault injection test reported that nilfs_btnode_create_block, a
helper function that allocates a new node block for b-trees, causes a
kernel BUG for disk images where the file system block size is smaller
than the page size.

This was due to unexpected flags on the newly allocated buffer head, and
it turned out to be because the buffer flags were not cleared by
nilfs_btnode_abort_change_key() after an error occurred during a b-tree
update operation and the buffer was later reused in that state.

Fix this issue by using nilfs_btnode_delete() to abandon the unused
preallocated buffer in nilfs_btnode_abort_change_key().

Link: https://lkml.kernel.org/r/20230513102428.10223-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+b0a35a5c1f7e846d3b09@syzkaller.appspotmail.com
Closes: https://lkml.kernel.org/r/000000000000d1d6c205ebc4d512@google.com
Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nilfs2/btnode.c