]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring: hold 'ctx' reference around task_work queue + execute
authorJens Axboe <axboe@kernel.dk>
Tue, 11 Aug 2020 14:04:14 +0000 (08:04 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:20 +0000 (08:24 +0200)
commitf93bc10c64afceb019ccdc7b5424ecedbd613f64
treed5914e45620be0b8ffc8405cc12ba4472333cd70
parentda914d858adca1bbfd3b39f8dee44d76a568e43a
io_uring: hold 'ctx' reference around task_work queue + execute

commit 6d816e088c359866f9867057e04f244c608c42fe upstream.

We're holding the request reference, but we need to go one higher
to ensure that the ctx remains valid after the request has finished.
If the ring is closed with pending task_work inflight, and the
given io_kiocb finishes sync during issue, then we need a reference
to the ring itself around the task_work execution cycle.

Cc: stable@vger.kernel.org # v5.7+
Reported-by: syzbot+9b260fc33297966f5a8e@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c