Commit 9e3072e3 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by NeilBrown

md-cluster: init suspend_list and suspend_lock early in join

If the node just join the cluster, and receive the msg from other nodes
before init suspend_list, it will cause kernel crash due to NULL pointer
dereference, so move the initializations early to fix the bug.

md-cluster: Joined cluster 3578507b-e0cb-6d4f-6322-696cd7b1b10c slot 3
BUG: unable to handle kernel NULL pointer dereference at           (null)
... ... ...
Call Trace:
[<ffffffffa0444924>] process_recvd_msg+0x2e4/0x330 [md_cluster]
[<ffffffffa0444a06>] recv_daemon+0x96/0x170 [md_cluster]
[<ffffffffa045189d>] md_thread+0x11d/0x170 [md_mod]
[<ffffffff810768c4>] kthread+0xb4/0xc0
[<ffffffff8151927c>] ret_from_fork+0x7c/0xb0
... ... ...
RIP  [<ffffffffa0443581>] __remove_suspend_info+0x11/0xa0 [md_cluster]
Reviewed-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent b5ef5678
...@@ -671,6 +671,8 @@ static int join(struct mddev *mddev, int nodes) ...@@ -671,6 +671,8 @@ static int join(struct mddev *mddev, int nodes)
if (!cinfo) if (!cinfo)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&cinfo->suspend_list);
spin_lock_init(&cinfo->suspend_lock);
init_completion(&cinfo->completion); init_completion(&cinfo->completion);
mutex_init(&cinfo->sb_mutex); mutex_init(&cinfo->sb_mutex);
...@@ -736,9 +738,6 @@ static int join(struct mddev *mddev, int nodes) ...@@ -736,9 +738,6 @@ static int join(struct mddev *mddev, int nodes)
goto err; goto err;
} }
INIT_LIST_HEAD(&cinfo->suspend_list);
spin_lock_init(&cinfo->suspend_lock);
ret = gather_all_resync_info(mddev, nodes); ret = gather_all_resync_info(mddev, nodes);
if (ret) if (ret)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment