io_uring: account fixed file references correctly in batch
authorJens Axboe <axboe@kernel.dk>
Thu, 9 Jan 2020 14:52:28 +0000 (07:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Jan 2020 22:05:04 +0000 (15:05 -0700)
commit87247fc5d4c519b1c48764a07210f222b337388a
treeb90c336534d4712fe77e282e7c38007f5003c2ea
parent3edcd3102675239ddc7b037af66be28f68d0656e
io_uring: account fixed file references correctly in batch

We can't assume that the whole batch has fixed files in it. If it's a
mix, or none at all, then we can end up doing a ref put that either
messes up accounting, or causes an oops if we have no fixed files at
all.

Also ensure we free requests properly between inflight accounted and
normal requests.

Fixes: 82c721577011 ("io_uring: extend batch freeing to cover more cases")
Reported-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Tested-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c