summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinbaiye <linbaiye@gmail.com>2012-09-20 12:37:29 +0800
committerAnand Avati <avati@redhat.com>2012-09-20 09:32:37 -0700
commit2fc6834e7a5d721e97a47f3ebaa201902af73c5a (patch)
tree805b43fa8c394aa56ff0e46724b0e89b6986f8f9
parente09245b8d152fdae8152f8e29d2be1827e6090e1 (diff)
Prevent fuse from setting an invalid value of fd_ctx
This patch is used to prevent __fd_ctx_set() from setting an invalid value. Change-Id: I6756d83eab20fc485b3696ae341e21324f1c885c BUG: 789278 Signed-off-by: linbaiye <linbaiye@gmail.com> Reviewed-on: http://review.gluster.org/3961 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 9bf07bf18b9..234af8041c2 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -58,7 +58,9 @@ __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd)
if (fd_ctx == NULL) {
fd_ctx = GF_CALLOC (1, sizeof (*fd_ctx),
gf_fuse_mt_fd_ctx_t);
-
+ if (!fd_ctx) {
+ goto out;
+ }
ret = __fd_ctx_set (fd, this,
(uint64_t)(unsigned long)fd_ctx);
if (ret < 0) {
@@ -68,7 +70,7 @@ __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd)
fd_ctx = NULL;
}
}
-
+out:
return fd_ctx;
}