summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2015-11-10 18:04:00 -0800
committerShreyas Siravara <sshreyas@fb.com>2017-09-03 17:09:41 +0000
commit51f797ce900527d8441269f3ebdc5456cfc299e0 (patch)
tree92a984c75b248360e326402f02d01f4b40ede5fc
parent493746d10f0a8dcc270fae0a43d5e77beb7a2bd5 (diff)
storage/posix: Fix crash in posix_make_ancestryfromgfid
Summary: - Log an OOPS and bail when *parent is null just before going into posix_resolve code path (to avoid crash) Test Plan: - Prove test/canary on cluster Differential Revision: https://phabricator.fb.com/D2640497 Change-Id: I6140ef6fdb711748dad1c66d929aca36328bc574 Reviewed-on: https://review.gluster.org/17969 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
-rw-r--r--xlators/storage/posix/src/posix-handle.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c
index 558755af009..da0bca6e41c 100644
--- a/xlators/storage/posix/src/posix-handle.c
+++ b/xlators/storage/posix/src/posix-handle.c
@@ -198,6 +198,16 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
goto out;
}
+ if (!*parent) {
+ /* There's no real "root" cause for how we end up here,
+ * so for now let's log this and bail out to prevent
+ * crashes.
+ */
+ gf_msg (this->name, GF_LOG_WARNING, P_MSG_INODE_RESOLVE_FAILED,
+ 0, "OOPS: *parent is null (path: %s), bailing!", path);
+ goto out;
+ }
+
memset (&iabuf, 0, sizeof (iabuf));
inode = posix_resolve (this, itable, *parent, dir_name, &iabuf);