aboutsummaryrefslogtreecommitdiff
path: root/sshfs.c
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2017-07-12 16:43:23 +0200
committerNikolaus Rath <Nikolaus@rath.org>2017-07-12 17:10:18 +0200
commitcc5d6bbbc5b7e78296f5245988b9ba947076a1b8 (patch)
treedc9d5aea1c728819a084ddeafde24dc593bf956d /sshfs.c
parent2aced1f7a41ea7e6176631e785431d15a9aa340c (diff)
downloadsshfs-cc5d6bbbc5b7e78296f5245988b9ba947076a1b8.tar
sshfs-cc5d6bbbc5b7e78296f5245988b9ba947076a1b8.tar.gz
sshfs-cc5d6bbbc5b7e78296f5245988b9ba947076a1b8.tar.bz2
sshfs-cc5d6bbbc5b7e78296f5245988b9ba947076a1b8.zip
sftp_readdir_async(): don't access request when it may have been freed
Fixes: #7
Diffstat (limited to 'sshfs.c')
-rw-r--r--sshfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sshfs.c b/sshfs.c
index 567c9f8..14ac12f 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -2072,11 +2072,16 @@ static int sftp_readdir_async(struct buffer *handle, fuse_cache_dirh_t h,
outstanding--;
if (done) {
+ /* We need to cache want_reply, since processing
+ thread may free req right after unlock() if
+ want_reply == 0 */
+ int want_reply;
pthread_mutex_lock(&sshfs.lock);
if (sshfs_req_pending(req))
req->want_reply = 0;
+ want_reply = req->want_reply;
pthread_mutex_unlock(&sshfs.lock);
- if (!req->want_reply)
+ if (!want_reply)
continue;
}