From 1877c43a6530e92ef9dee52463ddc4216a703329 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 9 Dec 2014 12:24:38 +0100 Subject: nfs: prevent potential NULL dereference in mnt3_readlink_cbk() In case 'mres' is NULL, we jump to 'mnterr' where 'mres->req' will be used. This will cause a segmentation fault, which we really do not want. Change-Id: I01d6f3aa0343def54dcd4a5610001ff7d62c8834 CID: 1256179 BUG: 789278 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/9257 Tested-by: Gluster Build System Reviewed-by: jiffin tony Thottan Reviewed-by: Humble Devassy Chirammal --- xlators/nfs/server/src/mount3.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index f76c1c41ff2..c7b90a5fb2c 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -1078,8 +1078,12 @@ mnt3_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return ret; mnterr: - mntstat = mnt3svc_errno_to_mnterr (-ret); - mnt3svc_mnt_error_reply (mres->req, mntstat); + if (mres) { + mntstat = mnt3svc_errno_to_mnterr (-ret); + mnt3svc_mnt_error_reply (mres->req, mntstat); + } else + gf_log (GF_MNT, GF_LOG_CRITICAL, + "mres == NULL, this should *never* happen"); if (absolute_path) GF_FREE (absolute_path); if (parent_path) -- cgit