storage/posix: Fix an access-after-free bug in release() and releasedir().
Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 533 (close() should not block main loop) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=533
This commit is contained in:
parent
61dbadb2e7
commit
7b12c4eb7e
@ -1125,6 +1125,13 @@ posix_releasedir (xlator_t *this,
|
||||
|
||||
priv = this->private;
|
||||
|
||||
if (!pfd->path) {
|
||||
op_errno = EBADFD;
|
||||
gf_log (this->name, GF_LOG_DEBUG,
|
||||
"pfd->path was NULL. fd=%p pfd=%p",
|
||||
fd, pfd);
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&priv->janitor_lock);
|
||||
{
|
||||
INIT_LIST_HEAD (&pfd->list);
|
||||
@ -1133,14 +1140,6 @@ posix_releasedir (xlator_t *this,
|
||||
}
|
||||
pthread_mutex_unlock (&priv->janitor_lock);
|
||||
|
||||
if (!pfd->path) {
|
||||
op_errno = EBADFD;
|
||||
gf_log (this->name, GF_LOG_DEBUG,
|
||||
"pfd->path was NULL. fd=%p pfd=%p",
|
||||
fd, pfd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
op_ret = 0;
|
||||
|
||||
out:
|
||||
@ -2782,6 +2781,14 @@ posix_release (xlator_t *this,
|
||||
|
||||
_fd = pfd->fd;
|
||||
|
||||
if (pfd->dir) {
|
||||
op_ret = -1;
|
||||
op_errno = EBADF;
|
||||
gf_log (this->name, GF_LOG_DEBUG,
|
||||
"pfd->dir is %p (not NULL) for file fd=%p",
|
||||
pfd->dir, fd);
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&priv->janitor_lock);
|
||||
{
|
||||
INIT_LIST_HEAD (&pfd->list);
|
||||
@ -2790,15 +2797,6 @@ posix_release (xlator_t *this,
|
||||
}
|
||||
pthread_mutex_unlock (&priv->janitor_lock);
|
||||
|
||||
if (pfd->dir) {
|
||||
op_ret = -1;
|
||||
op_errno = EBADF;
|
||||
gf_log (this->name, GF_LOG_DEBUG,
|
||||
"pfd->dir is %p (not NULL) for file fd=%p",
|
||||
pfd->dir, fd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
LOCK (&priv->lock);
|
||||
{
|
||||
priv->stats.nr_files--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user