]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring: fix fget/fput handling
authorJens Axboe <axboe@kernel.dk>
Wed, 13 Mar 2019 18:39:28 +0000 (12:39 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 15 Mar 2019 17:17:05 +0000 (11:17 -0600)
commit09bb839434bd845c01da3d159b0c126fe7fa90da
tree70311cb80237d36e571b4d67a0a9d8e00161cac2
parentd530a402a114efcf6d2b88d7f628856dade5b90b
io_uring: fix fget/fput handling

This isn't a straight port of commit 84c4e1f89fef for aio.c, since
io_uring doesn't use files in exactly the same way. But it's pretty
close. See the commit message for that commit.

This essentially fixes a use-after-free with the poll command
handling, but it takes cue from Linus's approach to just simplifying
the file handling. We move the setup of the file into a higher level
location, so the individual commands don't have to deal with it. And
then we release the reference when we free the associated io_kiocb.

Fixes: 221c5eb23382 ("io_uring: add support for IORING_OP_POLL")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c