summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/fd.c
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2015-05-12 16:36:55 +0530
committerNiels de Vos <ndevos@redhat.com>2015-08-26 09:17:19 -0700
commit6c4096f5e6a6d0f2b21cb4b2bea098b6f4eebbed (patch)
tree6fa6706c3aa5f25e312af30f73fabcce1e4efa20 /libglusterfs/src/fd.c
parent7f346e567edb94b008a5f0fa9f614fa8a296636b (diff)
libgfapi: Gracefully exit when glfd is invalid
This is a backport of: http://review.gluster.org/10759 When glfs_* methods operating on glfd are invoked after calling glfs_close(), the program segfaults inside __GLFS_ENTRY_VALIDATE_FD trying to deference glfd->fd->inode which is invalid. Also, returning EBADF seemed more specific than EINVAL. BUG: 1240920 Change-Id: I13a92dca52da9a300252b69e026581b3a9e931fd Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on-master: http://review.gluster.org/10759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/11571 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: bipin kunal <bkunal@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src/fd.c')
-rw-r--r--libglusterfs/src/fd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index ea74d03b0a9..25cea496d73 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -537,7 +537,7 @@ fd_destroy (fd_t *fd)
}
UNLOCK (&fd->inode->lock);
inode_unref (fd->inode);
- fd->inode = (inode_t *)0xaaaaaaaa;
+ fd->inode = NULL;
fd_lk_ctx_unref (fd->lk_ctx);
mem_put (fd);
out: