From c827682e4df44ec6aaae3780c325568fb43053ff Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Wed, 24 Apr 2019 22:02:51 +0530 Subject: glusterd: coverity fixes Addresses the following: * CID 1124776: Resource leaks (RESOURCE_LEAK) - Variable "aa" going out of scope leaks the storage it points to in glusterd-volgen.c * Bunch of CHECKED_RETURN defects in the callers of synctask_barrier_init * CID 1400755: Error handling issues (CHECKED_RETURN) - Calling "gf_is_service_running" without checking return value in xlators/mgmt/glusterd/src/glusterd-shd-svc.c: 671 in glusterd_shdsvc_stop() * CID 1400745: Memory - illegal accesses (USE_AFTER_FREE) - Dereferencing freed pointer "volinfo" in /xlators/mgmt/glusterd/src/glusterd-shd-svc.c: 460 in glusterd_shdsvc_start() * CID 1400742: Program hangs (LOCK) - adding annotation to fix this false positive Updates: bz#789278 Change-Id: I02f16e7eeb8c5cf72f7d0b29d00df4f03b3718b3 Signed-off-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-mgmt.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 61ad66ee6ec..f5f44f6b2a9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -757,7 +757,10 @@ glusterd_mgmt_v3_initiate_lockdown(glusterd_op_t op, dict_t *dict, /* Sending mgmt_v3 lock req to other nodes in the cluster */ gd_syncargs_init(&args, NULL); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; + peer_cnt = 0; RCU_READ_LOCK; @@ -1107,7 +1110,10 @@ glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict, /* Sending Pre Validation req to other nodes in the cluster */ gd_syncargs_init(&args, req_dict); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; + peer_cnt = 0; RCU_READ_LOCK; @@ -1457,7 +1463,10 @@ glusterd_mgmt_v3_brick_op(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, /* Sending brick op req to other nodes in the cluster */ gd_syncargs_init(&args, op_ctx); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; + peer_cnt = 0; RCU_READ_LOCK; @@ -1721,7 +1730,9 @@ glusterd_mgmt_v3_commit(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, /* Sending commit req to other nodes in the cluster */ gd_syncargs_init(&args, op_ctx); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; peer_cnt = 0; RCU_READ_LOCK; @@ -1962,7 +1973,10 @@ glusterd_mgmt_v3_post_validate(glusterd_op_t op, int32_t op_ret, dict_t *dict, /* Sending Post Validation req to other nodes in the cluster */ gd_syncargs_init(&args, req_dict); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; + peer_cnt = 0; RCU_READ_LOCK; -- cgit