]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level()
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Sun, 2 Oct 2022 03:08:04 +0000 (12:08 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 14 Nov 2022 10:25:45 +0000 (11:25 +0100)
commit9f1985ceafccc06d636cc63504240753969c5173
tree47bad29370395695d89a313b71b4aa03054843c3
parent7247a1b59979fc803af462781f1e5cc8b8ae4b4d
nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level()

BugLink: https://bugs.launchpad.net/bugs/1995638
commit 21a87d88c2253350e115029f14fe2a10a7e6c856 upstream.

If the i_mode field in inode of metadata files is corrupted on disk, it
can cause the initialization of bmap structure, which should have been
called from nilfs_read_inode_common(), not to be called.  This causes a
lockdep warning followed by a NULL pointer dereference at
nilfs_bmap_lookup_at_level().

This patch fixes these issues by adding a missing sanitiy check for the
i_mode field of metadata file's inode.

Link: https://lkml.kernel.org/r/20221002030804.29978-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+2b32eb36c1a825b7a74c@syzkaller.appspotmail.com
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/nilfs2/inode.c