diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2014-07-12 22:31:45 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-07-27 13:36:46 -0700 |
commit | 3e7c3b25129df098511970c79faf561be08ef87b (patch) | |
tree | 533252cc5068c98face7cea1789d33a65fe6f75d /xlators/mgmt/glusterd | |
parent | 7b7f8533331f9478724e226a9c3a4a34dfe11228 (diff) |
rpc,glusterd: Set ret to 0 after call to rpc_clnt_submit()
This is to guard against a double STACK_DESTROY in the event that
rpc_clnt_submit() failed and returned -1 anytime after sending the
request over the wire. in which case the stack could be destroyed
twice: once in the callback function of the request and once in
the error codepath of some of the callers of glusterd_submit_request().
This bug was introduced in http://review.gluster.org/#/c/8257/
Change-Id: I18a345db6eafc62ba312743201ced7d3f8697622
BUG: 1116243
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/8301
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 06283884357..14d98c544aa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -264,9 +264,16 @@ glusterd_submit_request_unlocked (struct rpc_clnt *rpc, void *req, } /* Send the msg */ - ret = rpc_clnt_submit (rpc, prog, procnum, cbkfn, - &iov, count, - NULL, 0, iobref, frame, NULL, 0, NULL, 0, NULL); + rpc_clnt_submit (rpc, prog, procnum, cbkfn, &iov, count, NULL, 0, + iobref, frame, NULL, 0, NULL, 0, NULL); + + /* Unconditionally set ret to 0 here. This is to guard against a double + * STACK_DESTROY in case of a failure in rpc_clnt_submit AFTER the + * request is sent over the wire: once in the callback function of the + * request and once in the error codepath of some of the callers of + * glusterd_submit_request(). + */ + ret = 0; out: if (new_iobref) { iobref_unref (iobref); |