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
This commit is contained in:
Shehjar Tikoo 2009-12-18 07:06:27 +00:00 committed by Vijay Bellur
parent ff5170faa1
commit 4921bc8c0f

View File

@ -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;