summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-08-04 18:15:45 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-08-04 17:07:11 -0700
commitaaf483185e6fdd1b0102ee2ae27e53826efdfc21 (patch)
tree1af27fb1aafdea8d87b6c26e0f825c8ec6afa343 /xlators/storage
parent33b5ce10ef7b5c6db6e73f6070fd4579c2765c94 (diff)
add check for making sure 'fd' belongs to directory in posix-readdir
The root cause of this error is not found yet. But this check will make sure that there is no crash when the situation happens. Segfault can happen when a readdir() call comes over file's fd. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 192 (sefault in posix-readdir) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=192
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 1772fc3ad3f..4bcea07f9c6 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3536,6 +3536,13 @@ posix_readdir (call_frame_t *frame, xlator_t *this,
goto out;
}
pfd = (struct posix_fd *)(long)tmp_pfd;
+ if (!pfd->path) {
+ op_errno = EBADFD;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "pfd does not have path set (possibly file "
+ "fd, fd=%p)", fd);
+ goto out;
+ }
real_path = pfd->path;
real_path_len = strlen (real_path);