summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2016-06-08 11:53:59 -0700
committerJeff Darcy <jeff@pl.atyp.us>2017-11-01 13:30:28 +0000
commit4a53ed72478c3ce788e295223d45cb578949241e (patch)
tree040c62eabd684c2c811d396d5a91f7a0733cfadd
parentf6983f825f10f1795118ca140fd32e9c280bb5a4 (diff)
nfs: Fix crash bug when mnt3_resolve_subdir_cbk() fails
Summary: When mnt3_resolve_subdir_cbk() fails (this can happen when racing operations), authorized_path is sometimes NULL. We try to run strlen() on this path and as a result we crash. This diff fixes that by checking if path is NULL before dereferencing it. Test Plan: Run with patch and observe that there is no crash. Prove test for auth code. BUG: 1365683 Change-Id: I2e2bdfdc61ae906788611e151d2c753b79b312df Signed-off-by: Shreyas Siravara <sshreyas@fb.com>
-rw-r--r--xlators/nfs/server/src/mount3.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index db416be6090..b171d2ce138 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -696,6 +696,9 @@ __mnt3_build_mountid_from_path (const char *path, uuid_t mountid)
uint32_t hashed_path = 0;
int ret = -1;
+ if (!path)
+ goto out;
+
while (strlen (path) > 0 && path[0] == '/')
path++;