From e7897b80ba38066af2dc306b98c466e9cfe87e81 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 2 Aug 2012 20:37:39 +0530 Subject: glusterd: Fix glusterd crash resulting from uninitialised pointer PROBLEM: glusterd crashes during replace-brick operation as the pointer old_brickinfo is dereferenced without being initialised. FIX: Have old_brickinfo initialised to point to the brick info of the brick being replaced before dereferencing it. TEST: Ran glusterd in debug mode before and after the fix; process crash ceased in the latter case. Change-Id: I53f21b5424f534bbdba3b3fc407d4501a2c0052f BUG: 844332 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.com/3777 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 86c4d6e2d..61ee5d082 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -1369,6 +1369,12 @@ glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo, goto out; ret = glusterd_resolve_brick (new_brickinfo); + + if (ret) + goto out; + + ret = glusterd_volume_brickinfo_get_by_brick (old_brick, + volinfo, &old_brickinfo); if (ret) goto out; -- cgit