From ddcfd0888294b99049c7b05c0a43129b5099b19e Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Tue, 18 Sep 2012 13:09:10 +0530 Subject: protocol/server: put the connection back if setvolume fails In server_setvolume, put the connection back (thus removing it from a the list of connections that protocol/server is maintaining if the connection object is a newly created one) if some operations such as getting the bound_xl etc fails. Otherwise the process might segfault upon statedump, when it tries to access NULL bound_xl of a connection. Change-Id: Ifa340f534cd88d5601a9219da622b323fbe98b80 BUG: 858191 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/3953 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/protocol/server/src/server-handshake.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xlators/protocol/server') diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index 6bbf8df0..d893716c 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -588,7 +588,6 @@ server_setvolume (rpcsvc_request_t *req) if (ret < 0) gf_log (this->name, GF_LOG_DEBUG, "failed to set error msg"); - goto fail; } @@ -665,6 +664,13 @@ fail: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); + /* if bound_xl is NULL or something fails, then put the connection + * back. Otherwise the connection would have been added to the + * list of connections the server is maintaining and might segfault + * during statedump when bound_xl of the connection is accessed. + */ + if (op_ret && conn) + server_connection_put (this, conn, NULL); server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_setvolume_rsp); -- cgit