summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-12-18 07:06:27 +0000
committerVijay Bellur <vijay@dev.gluster.com>2009-12-18 08:41:33 -0800
commit4921bc8c0fd045fdb82eb21eb358d378cdcad976 (patch)
tree0ca32627bda498f0e6cbb2c90e2fe0232253f017
parentff5170faa131b201bf8170601dbeae18b400542f (diff)
distribute: Dont dereference sbuf on failed readlink_cbk
This fixes a crash that was caused due to a NULL pointer deref because a NULL sbuf is returned if the readlink fop fails. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 492 (distribute crashes in readlink) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=492
-rw-r--r--xlators/cluster/dht/src/dht-common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 50307eb10..9c5b9006b 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1352,6 +1352,9 @@ dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
local = frame->local;
+ if (op_ret == -1)
+ goto err;
+
if (local) {
sbuf->st_ino = local->st_ino;
} else {
@@ -1359,6 +1362,7 @@ dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_errno = EINVAL;
}
+err:
DHT_STACK_UNWIND (readlink, frame, op_ret, op_errno, path, sbuf);
return 0;