]> git.baikalelectronics.ru Git - kernel.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)
commit0063b7aa302f10f39fd04449b62cec189904dc05
tree70311cb80237d36e571b4d67a0a9d8e00161cac2
parentb0561096097bb2cc070c8db6b8d8f821c7a02a45
io_uring: fix fget/fput handling

This isn't a straight port of commit 7865c1581134 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: 0edea71e23c0 ("io_uring: add support for IORING_OP_POLL")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c