Skip to content

Commit

Permalink
fuse: fix unlocked access to processing queue
Browse files Browse the repository at this point in the history
fuse_dev_release() assumes that it's the only one referencing the
fpq->processing list, but that's not true, since fuse_abort_conn() can be
doing the same without any serialization between the two.

Fixes: c369604 ("fuse: separate pqueue for clones")
Cc: <stable@vger.kernel.org> # v4.2
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Jul 26, 2018
1 parent 8711437 commit 45ff350
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,9 +2150,15 @@ int fuse_dev_release(struct inode *inode, struct file *file)
if (fud) {
struct fuse_conn *fc = fud->fc;
struct fuse_pqueue *fpq = &fud->pq;
LIST_HEAD(to_end);

spin_lock(&fpq->lock);
WARN_ON(!list_empty(&fpq->io));
end_requests(fc, &fpq->processing);
list_splice_init(&fpq->processing, &to_end);
spin_unlock(&fpq->lock);

end_requests(fc, &to_end);

/* Are we the last open device? */
if (atomic_dec_and_test(&fc->dev_count)) {
WARN_ON(fc->iq.fasync != NULL);
Expand Down

0 comments on commit 45ff350

Please sign in to comment.