android_kernel_xiaomi_sm7250/fs/ocfs2
Jia Guo 20141feb9b ocfs2: fix a panic problem caused by o2cb_ctl
[ Upstream commit cc725ef3cb202ef2019a3c67c8913efa05c3cce6 ]

In the process of creating a node, it will cause NULL pointer
dereference in kernel if o2cb_ctl failed in the interval (mkdir,
o2cb_set_node_attribute(node_num)] in function o2cb_add_node.

The node num is initialized to 0 in function o2nm_node_group_make_item,
o2nm_node_group_drop_item will mistake the node number 0 for a valid
node number when we delete the node before the node number is set
correctly.  If the local node number of the current host happens to be
0, cluster->cl_local_node will be set to O2NM_INVALID_NODE_NUM while
o2hb_thread still running.  The panic stack is generated as follows:

  o2hb_thread
      \-o2hb_do_disk_heartbeat
          \-o2hb_check_own_slot
              |-slot = &reg->hr_slots[o2nm_this_node()];
              //o2nm_this_node() return O2NM_INVALID_NODE_NUM

We need to check whether the node number is set when we delete the node.

Link: http://lkml.kernel.org/r/133d8045-72cc-863e-8eae-5013f9f6bc51@huawei.com
Signed-off-by: Jia Guo <guojia12@huawei.com>
Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
Acked-by: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-05 22:32:59 +02:00
..
cluster ocfs2: fix a panic problem caused by o2cb_ctl 2019-04-05 22:32:59 +02:00
dlm ocfs2: improve ocfs2 Makefile 2019-02-12 19:47:18 +01:00
dlmfs ocfs2: improve ocfs2 Makefile 2019-02-12 19:47:18 +01:00
acl.c ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute 2018-01-31 17:18:35 -08:00
acl.h
alloc.c ocfs2: clean up some unnecessary code 2018-08-17 16:20:27 -07:00
alloc.h ocfs2: try to reuse extent block in dealloc without meta_alloc 2018-01-31 17:18:35 -08:00
aops.c ocfs2: free up write context when direct IO failed 2018-11-21 09:19:18 +01:00
aops.h ocfs2: keep the trace point consistent with the function name 2018-04-05 21:36:21 -07:00
blockcheck.c
blockcheck.h
buffer_head_io.c ocfs2: don't clear bh uptodate for block read 2019-02-12 19:47:18 +01:00
buffer_head_io.h ocfs2: clean up some unused function declarations 2017-11-15 18:21:01 -08:00
dcache.c
dcache.h
dir.c ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry 2018-11-21 09:19:18 +01:00
dir.h
dlmglue.c ocfs2: fix a GCC warning 2018-10-13 09:31:02 +02:00
dlmglue.h ocfs2: ocfs2_inode_lock_tracker does not distinguish lock level 2018-06-07 17:34:33 -07:00
export.c ocfs2: fix potential use after free 2018-12-17 09:24:41 +01:00
export.h
extent_map.c ocfs2: add ocfs2_overwrite_io() 2018-01-31 17:18:35 -08:00
extent_map.h ocfs2: add ocfs2_overwrite_io() 2018-01-31 17:18:35 -08:00
file.c vfs: dedupe: rationalize args 2018-07-06 23:57:03 +02:00
file.h ocfs2: clean up redundant function declarations 2018-06-07 17:34:33 -07:00
filecheck.c ocfs2: add duplicated ino number check 2018-04-05 21:36:22 -07:00
filecheck.h ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
heartbeat.c
heartbeat.h
inode.c ocfs2: clean up some unnecessary code 2018-08-17 16:20:27 -07:00
inode.h
ioctl.c ocfs2: eliminate a misreported warning 2018-06-07 17:34:33 -07:00
ioctl.h
journal.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
journal.h
Kconfig
localalloc.c ocfs2: fix panic due to unrecovered local alloc 2019-01-26 09:32:43 +01:00
localalloc.h
locks.c
locks.h
Makefile ocfs2: improve ocfs2 Makefile 2019-02-12 19:47:18 +01:00
mmap.c fs: ocfs2: use new return type vm_fault_t 2018-06-07 17:34:34 -07:00
mmap.h
move_extents.c ocfs2: fix deadlock caused by ocfs2_defrag_extent() 2018-12-17 09:24:40 +01:00
move_extents.h
namei.c ocfs2: drop a VLA in ocfs2_orphan_del() 2018-06-07 17:34:34 -07:00
namei.h
ocfs1_fs_compat.h
ocfs2_fs.h ocfs2: correct the comments position of struct ocfs2_dir_block_trailer 2018-06-07 17:34:34 -07:00
ocfs2_ioctl.h
ocfs2_lockid.h ocfs2: add trimfs dlm lock resource 2018-01-31 17:18:35 -08:00
ocfs2_lockingver.h
ocfs2_trace.h ocfs2: keep the trace point consistent with the function name 2018-04-05 21:36:21 -07:00
ocfs2.h ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
quota_global.c ocfs2: convert to new i_version API 2018-01-29 06:42:21 -05:00
quota_local.c ocfs2: return -EROFS when filesystem becomes read-only 2018-08-17 16:20:27 -07:00
quota.h
refcounttree.c ocfs2: fix inode bh swapping mixup in ocfs2_reflink_inodes_lock 2019-04-03 06:26:23 +02:00
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c treewide: Align function definition open/close braces 2018-03-26 11:13:09 +02:00
stackglue.c
stackglue.h
suballoc.c ocfs2: remove two unused functions from suballoc.c 2018-04-05 21:36:22 -07:00
suballoc.h
super.c ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
super.h
symlink.c
symlink.h
sysfile.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sysfile.h
uptodate.c ocfs2: remove unnecessary null pointer check before kmem_cache_destroy() 2018-04-05 21:36:22 -07:00
uptodate.h
xattr.c ocfs2: use 'osb' instead of 'OCFS2_SB()' 2018-04-05 21:36:21 -07:00
xattr.h