linux/fs/ocfs2/cluster
Jia Guo cc725ef3cb ocfs2: fix a panic problem caused by o2cb_ctl
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>
2019-03-05 21:07:13 -08:00
..
Makefile
heartbeat.c ocfs2: optimize the reading of heartbeat data 2018-12-28 12:11:45 -08:00
heartbeat.h ocfs2: cleanup unused func declaration and assignment 2017-11-15 18:21:01 -08:00
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-18 10:15:09 -08: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-03-05 21:07:13 -08: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 iov_iter: Separate type from direction and use accessor functions 2018-10-24 00:41:07 +01:00
tcp.h
tcp_internal.h ocfs2/cluster: neaten a member of o2net_msg_handler 2018-01-31 17:18:34 -08:00