From 4921bc8c0fd045fdb82eb21eb358d378cdcad976 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Fri, 18 Dec 2009 07:06:27 +0000 Subject: 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 Signed-off-by: Vijay Bellur BUG: 492 (distribute crashes in readlink) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=492 --- xlators/cluster/dht/src/dht-common.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'xlators/cluster/dht/src') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 50307eb10c4..9c5b9006b04 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; -- cgit