From 4a53ed72478c3ce788e295223d45cb578949241e Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Wed, 8 Jun 2016 11:53:59 -0700 Subject: 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 --- xlators/nfs/server/src/mount3.c | 3 +++ 1 file changed, 3 insertions(+) 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++; -- cgit