diff options
author | Guoqing Jiang <gqjiang@suse.com> | 2017-05-16 09:01:25 +0300 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-05-22 06:37:09 +0300 |
commit | 2dffdc0724004f38f5e39907747b53e4b0d80e59 (patch) | |
tree | f45ab141f5ca4b9f9ce3b8758393937e99a82597 /drivers/md/md-cluster.c | |
parent | 08332893e37af6ae779367e78e444f8f9571511d (diff) | |
download | linux-2dffdc0724004f38f5e39907747b53e4b0d80e59.tar.xz |
md-cluster: fix potential lock issue in add_new_disk
The add_new_disk returns with communication locked if
__sendmsg returns failure, fix it with call unlock_comm
before return.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
CC: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/md-cluster.c')
-rw-r--r-- | drivers/md/md-cluster.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 7299ce2f08a8..03082e17c65c 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -1311,8 +1311,10 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev) cmsg.raid_slot = cpu_to_le32(rdev->desc_nr); lock_comm(cinfo, 1); ret = __sendmsg(cinfo, &cmsg); - if (ret) + if (ret) { + unlock_comm(cinfo); return ret; + } cinfo->no_new_dev_lockres->flags |= DLM_LKF_NOQUEUE; ret = dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_EX); cinfo->no_new_dev_lockres->flags &= ~DLM_LKF_NOQUEUE; |