kernel-fxtec-pro1x/fs/ocfs2/cluster
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
..
heartbeat.c ocfs2: make several functions and variables static (and some const) 2018-08-17 16:20:28 -07:00
heartbeat.h ocfs2: cleanup unused func declaration and assignment 2017-11-15 18:21:01 -08:00
Makefile
masklog.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
masklog.h ocfs2: free up write context when direct IO failed 2018-11-21 09:19:18 +01:00
netdebug.c ocfs2: free 'dummy_sc' in sc_fop_release() to prevent memory leak 2017-07-06 16:24:30 -07:00
nodemanager.c ocfs2: fix a panic problem caused by o2cb_ctl 2019-04-05 22:32:59 +02:00
nodemanager.h
ocfs2_heartbeat.h
ocfs2_nodemanager.h
quorum.c ocfs2/cluster: close a race that fence can't be triggered 2018-01-31 17:18:35 -08:00
quorum.h
sys.c
sys.h
tcp.c ocfs2: clean up some unnecessary code 2018-08-17 16:20:27 -07:00
tcp.h
tcp_internal.h ocfs2/cluster: neaten a member of o2net_msg_handler 2018-01-31 17:18:34 -08:00