summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-12-09 12:24:38 +0100
committerNiels de Vos <ndevos@redhat.com>2014-12-10 02:01:02 -0800
commit1877c43a6530e92ef9dee52463ddc4216a703329 (patch)
treea87f3b29b6f059d3af7bfbf20f274e50dcb1fb70
parent7cfa31434eb132adc0ac5cba4dcde600897cd2eb (diff)
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 <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9257 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
-rw-r--r--xlators/nfs/server/src/mount3.c8
1 files 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)