summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2015-11-10 18:04:00 -0800
committerJeff Darcy <jeff@pl.atyp.us>2017-12-13 21:05:42 +0000
commit2d0a763677b1f4e9938a1a1a2587883b2262aaf6 (patch)
treeb44a298e2c73c57ab79fe892b8473a1b1ae87fd9
parent8b8fea1a801f837a75307f4cd8e79e808760cb0b (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) > Reviewed-on: https://review.gluster.org/17969 > Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Change-Id: I6140ef6fdb711748dad1c66d929aca36328bc574 Signed-off-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix-handle.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c
index 99501177138..a3a8ea464d3 100644
--- a/xlators/storage/posix/src/posix-handle.c
+++ b/xlators/storage/posix/src/posix-handle.c
@@ -204,6 +204,18 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
while (top >= 0) {
+ 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_stack[top], &iabuf);