summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-18 08:56:56 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-18 07:41:58 -0700
commitb189d31f61ac3436bf0ad9ae2bff13efccbc06d0 (patch)
tree7f6b0716b8f5bd9c8688f3469631c8126955026c /xlators/mount
parent1aa2219484e040a950d55d9414e2b7e77df37fe7 (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')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c39
-rw-r--r--xlators/mount/fuse/src/fuse-resolve.c4
2 files changed, 40 insertions, 3 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
diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c
index b90ef3d5f8d..77a55cd701f 100644
--- a/xlators/mount/fuse/src/fuse-resolve.c
+++ b/xlators/mount/fuse/src/fuse-resolve.c
@@ -661,8 +661,6 @@ gf_resolve_done (fuse_state_t *state)
static int
gf_resolve_all (fuse_state_t *state)
{
- xlator_t *this = NULL;
-
if (state->resolve_now == NULL) {
state->resolve_now = &state->resolve;
@@ -682,7 +680,7 @@ gf_resolve_all (fuse_state_t *state)
gf_resolve_done (state);
} else {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_log ("fuse-resolve", GF_LOG_ERROR,
"Invalid pointer for state->resolve_now");
}