Skip to content

Commit bb7ee90

Browse files
Miklos Szeredigregkh
authored andcommitted
fuse: check connected before queueing on fpq->io
commit 80ef086 upstream. A request could end up on the fpq->io list after fuse_abort_conn() has reset fpq->connected and aborted requests on that list: Thread-1 Thread-2 ======== ======== ->fuse_simple_request() ->shutdown ->__fuse_request_send() ->queue_request() ->fuse_abort_conn() ->fuse_dev_do_read() ->acquire(fpq->lock) ->wait_for(fpq->lock) ->set err to all req's in fpq->io ->release(fpq->lock) ->acquire(fpq->lock) ->add req to fpq->io After the userspace copy is done the request will be ended, but req->out.h.error will remain uninitialized. Also the copy might block despite being already aborted. Fix both issues by not allowing the request to be queued on the fpq->io list after fuse_abort_conn() has processed this list. Reported-by: Pradeep P V K <pragalla@codeaurora.org> Fixes: fd22d62 ("fuse: no fc->lock for iqueue parts") Cc: <stable@vger.kernel.org> # v4.2 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 912e985 commit bb7ee90

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎fs/fuse/dev.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,15 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
12761276
goto restart;
12771277
}
12781278
spin_lock(&fpq->lock);
1279+
/*
1280+
* Must not put request on fpq->io queue after having been shut down by
1281+
* fuse_abort_conn()
1282+
*/
1283+
if (!fpq->connected) {
1284+
req->out.h.error = err = -ECONNABORTED;
1285+
goto out_end;
1286+
1287+
}
12791288
list_add(&req->list, &fpq->io);
12801289
spin_unlock(&fpq->lock);
12811290
cs->req = req;

0 commit comments

Comments
 (0)