diff options
author | Amar Tumballi <amar@gluster.com> | 2010-08-18 08:56:56 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-18 07:41:58 -0700 |
commit | b189d31f61ac3436bf0ad9ae2bff13efccbc06d0 (patch) | |
tree | 7f6b0716b8f5bd9c8688f3469631c8126955026c /xlators/mount/fuse/src/fuse-bridge.c | |
parent | 1aa2219484e040a950d55d9414e2b7e77df37fe7 (diff) |
fuse: prevent NULL dereference in case resolve on path failed.
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1391 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1391
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index ac8295b96de..798b87b0525 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -240,6 +240,13 @@ fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, void fuse_lookup_resume (fuse_state_t *state) { + if (!state->loc.parent && !state->loc.inode) { + gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", + state->loc.path); + send_fuse_err (state->this, state->finh, ENOENT); + free_fuse_state (state); + return; + } if (!state->loc.inode) state->loc.inode = inode_new (state->loc.parent->table); @@ -1004,6 +1011,14 @@ fuse_readlink (xlator_t *this, fuse_in_header_t *finh, void *msg) void fuse_mknod_resume (fuse_state_t *state) { + if (!state->loc.parent) { + gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", + state->loc.path); + send_fuse_err (state->this, state->finh, ENOENT); + free_fuse_state (state); + return; + } + if (!state->loc.inode) state->loc.inode = inode_new (state->loc.parent->table); else @@ -1056,6 +1071,14 @@ fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) void fuse_mkdir_resume (fuse_state_t *state) { + if (!state->loc.parent) { + gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", + state->loc.path); + send_fuse_err (state->this, state->finh, ENOENT); + free_fuse_state (state); + return; + } + if (!state->loc.inode) state->loc.inode = inode_new (state->loc.parent->table); else @@ -1182,6 +1205,14 @@ fuse_rmdir (xlator_t *this, fuse_in_header_t *finh, void *msg) void fuse_symlink_resume (fuse_state_t *state) { + if (!state->loc.parent) { + gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", + state->loc.path); + send_fuse_err (state->this, state->finh, ENOENT); + free_fuse_state (state); + return; + } + if (!state->loc.inode) state->loc.inode = inode_new (state->loc.parent->table); else @@ -1486,6 +1517,14 @@ fuse_create_resume (fuse_state_t *state) { fd_t *fd = NULL; + if (!state->loc.parent) { + gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", + state->loc.path); + send_fuse_err (state->this, state->finh, ENOENT); + free_fuse_state (state); + return; + } + if (!state->loc.inode) state->loc.inode = inode_new (state->loc.parent->table); else |