kernel-hacking-2024-linux-s.../fs/ocfs2
Jia-Ju Bai 2abb7d3b12 fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc()
In ocfs2_info_scan_inode_alloc(), there is an if statement on line 283
to check whether inode_alloc is NULL:

    if (inode_alloc)

When inode_alloc is NULL, it is used on line 287:

    ocfs2_inode_lock(inode_alloc, &bh, 0);
        ocfs2_inode_lock_full_nested(inode, ...)
            struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);

Thus, a possible null-pointer dereference may occur.

To fix this bug, inode_alloc is checked on line 286.

This bug is found by a static analysis tool STCheck written by us.

Link: http://lkml.kernel.org/r/20190726033717.32359-1-baijiaju1990@gmail.com
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-10-07 15:47:19 -07:00
..
cluster ocfs2: further debugfs cleanups 2019-09-24 15:54:07 -07:00
dlm ocfs2: wait for recovering done after direct unlock request 2019-09-24 15:54:07 -07:00
dlmfs
acl.c
acl.h
alloc.c ocfs2: checkpoint appending truncate log transaction before flushing 2019-09-24 15:54:07 -07:00
alloc.h
aops.c fs: ocfs2: fix a possible null-pointer dereference in ocfs2_write_end_nolock() 2019-10-07 15:47:19 -07:00
aops.h
blockcheck.c ocfs2: further debugfs cleanups 2019-09-24 15:54:07 -07:00
blockcheck.h ocfs: no need to check return value of debugfs_create functions 2019-07-12 11:05:41 -07:00
buffer_head_io.c
buffer_head_io.h
dcache.c fs/ocfs2: fix race in ocfs2_dentry_attach_lock() 2019-06-13 17:34:56 -10:00
dcache.h
dir.c fs/ocfs2/dir.c: remove set but not used variables 2019-09-24 15:54:07 -07:00
dir.h
dlmglue.c ocfs2: delete unnecessary checks before brelse() 2019-09-24 15:54:07 -07:00
dlmglue.h
export.c
export.h
extent_map.c ocfs2: delete unnecessary checks before brelse() 2019-09-24 15:54:07 -07:00
extent_map.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 405 2019-06-05 17:37:13 +02:00
file.c fs/ocfs2/file.c: remove set but not used variables 2019-09-24 15:54:07 -07:00
file.h
filecheck.c
filecheck.h
heartbeat.c
heartbeat.h
inode.c ocfs2: fix spelling mistake "ambigous" -> "ambiguous" 2019-09-24 15:54:07 -07:00
inode.h
ioctl.c fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc() 2019-10-07 15:47:19 -07:00
ioctl.h
journal.c
journal.h ocfs2: remove unused ocfs2_orphan_scan_exit() declaration 2019-09-24 15:54:07 -07:00
Kconfig
localalloc.c ocfs2: use kmemdup rather than duplicating its implementation 2019-07-12 11:05:41 -07:00
localalloc.h
locks.c
locks.h
Makefile
mmap.c
mmap.h
move_extents.c
move_extents.h
namei.c fs/ocfs2/namei.c: remove set but not used variables 2019-09-24 15:54:07 -07:00
namei.h
ocfs1_fs_compat.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 405 2019-06-05 17:37:13 +02:00
ocfs2.h ocfs2: further debugfs cleanups 2019-09-24 15:54:07 -07:00
ocfs2_fs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 405 2019-06-05 17:37:13 +02:00
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h
quota.h
quota_global.c
quota_local.c
refcounttree.c
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c
stackglue.c
stackglue.h
suballoc.c
suballoc.h
super.c ocfs2: further debugfs cleanups 2019-09-24 15:54:07 -07:00
super.h
symlink.c
symlink.h
sysfile.c
sysfile.h
uptodate.c
uptodate.h
xattr.c fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry() 2019-10-07 15:47:19 -07:00
xattr.h