summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2014-09-22 17:42:04 -0700
committerShreyas Siravara <sshreyas@fb.com>2016-12-16 08:32:19 -0800
commit5d7caee6851f19e5f18d94ed09eda78e9ab78474 (patch)
treee7c2b0376933a6cacc2e8bf587859b8064213f5a
parent401d1ee7e32d400a9c7b745cfd5f0716282e6bbe (diff)
nfs: Check for null buf, and set op_errno to EIO not 0
Summary: - Prevent crashes for the case where "getattr" actually failed and returned with a NULL buf, but the op_errno was set to 0. - This is a cherry-pick of D1571184 Signed-off-by: Shreyas Siravara <sshreyas@fb.com> Change-Id: Ia2d6ad7539df714f9420dcf063c7c14e727bb7e3 Reviewed-on: http://review.gluster.org/16152 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kevin Vigor <kvigor@fb.com>
-rw-r--r--xlators/nfs/server/src/nfs3.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 64287c5b1bd..57877b332de 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -778,6 +778,12 @@ nfs3svc_getattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
+ /* Prevent crashes for the case where this call fails
+ * and buf is left in a NULL state, yet the op_errno == 0.
+ */
+ if (!buf && op_errno == 0) {
+ op_errno = EIO;
+ }
status = nfs3_cbk_errno_status (op_ret, op_errno);
}