From 33d8a6956e66f384ad6b7a77d9c3017a9f36120d Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Wed, 19 Jul 2017 13:53:27 +0200
Subject: [PATCH 592/593] nfs: improve error handling for WebNFS mount
permissions
In case nfs3_funge_webnfs_zerolen_fh() returns an error, the
nfs3_call_state_t structure will not get initialized. This means that
calling `nfs3_call_state_wipe (cs)` will result in a segmentation fault
after commit daed52b8eb that makes nfs3_call_state_t refcounted.
>Reviewed-on: https://review.gluster.org/17822
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
>Reviewed-by: soumya k <skoduri@redhat.com>
Change-Id: I4c300aedf132a7fea95756dd278ff87d67722478
BUG: 1478136
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/114348
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/nfs/server/src/nfs3.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 7443dbc..52b948e 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -1583,7 +1583,8 @@ nfs3err:
NFS3_LOOKUP, stat, -ret,
cs ? cs->resolvedloc.path : NULL);
nfs3_lookup_reply (req, stat, NULL, NULL, NULL);
- nfs3_call_state_wipe (cs);
+ if (cs)
+ nfs3_call_state_wipe (cs);
/* Ret must be 0 after this so that the caller does not
* also send an RPC reply.
*/
--
1.8.3.1