From fef1270fc2d665c67084c4ce06f60fc8faed4d52 Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Fri, 10 May 2013 14:31:27 +0530 Subject: gluster/CLI: crash upon executing "peer status" command Problem: While doing "gluster peer status", cli_cmd_peer_status_cbk() creates the frame and passes as arg to gf_cli_list_friends() which sets frame->local to GF_CLI_LIST_PEERS flag (value: 0x1). It expects gf_cli_list_friends_cbk() [invoked through cli_cmd_submit()] to reset frame->local to NULL. But if cli_cmd_submit() fails some where before gf_cli_list_friends_cbk() gets invoked, then the flag value remains in frame->local and causes a SEGV while destroying the stack i.e. [CLI_STACK_DESTROY => cli_local_wipe()]. Fix: In gf_cli_list_friends(), if cli_cmd_submit() fails, then reset the value of frame->local to NULL. Change-Id: Ied19f07eaf67e3bd42c75cdc2ff3729b0789e632 BUG: 961691 Signed-off-by: Santosh Kumar Pradhan Reviewed-on: http://review.gluster.org/4976 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-rpc-ops.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 536402615..08f3bcae5 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2778,6 +2778,15 @@ gf_cli_list_friends (call_frame_t *frame, xlator_t *this, (xdrproc_t) xdr_gf1_cli_peer_list_req); out: + if (ret) { + /* + * If everything goes fine, gf_cli_list_friends_cbk() + * [invoked through cli_cmd_submit()]resets the + * frame->local to NULL. In case cli_cmd_submit() + * fails in between, RESET frame->local here. + */ + frame->local = NULL; + } gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; } -- cgit