From 2d0a763677b1f4e9938a1a1a2587883b2262aaf6 Mon Sep 17 00:00:00 2001 From: Richard Wareing Date: Tue, 10 Nov 2015 18:04:00 -0800 Subject: 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 Change-Id: I6140ef6fdb711748dad1c66d929aca36328bc574 Signed-off-by: Amar Tumballi --- xlators/storage/posix/src/posix-handle.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'xlators/storage') 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); -- cgit