]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring/cancel: re-grab ctx mutex after finishing wait
authorJens Axboe <axboe@kernel.dk>
Wed, 21 Dec 2022 14:11:33 +0000 (07:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:38 +0000 (12:02 +0100)
commit65b0371cd1370a762f768a53390a6383149e2653
treeadd529f182da1acb5ee9f95836179ac0b9436edf
parent83db1bd78e7e0b0c53a84ba7f4b9e0aa10e224c3
io_uring/cancel: re-grab ctx mutex after finishing wait

[ Upstream commit db12dbd503bd91d694f932736a90196b8db60f2d ]

If we have a signal pending during cancelations, it'll cause the
task_work run to return an error. Since we didn't run task_work, the
current task is left in TASK_INTERRUPTIBLE state when we need to
re-grab the ctx mutex, and the kernel will rightfully complain about
that.

Move the lock grabbing for the error cases outside the loop to avoid
that issue.

Reported-by: syzbot+7df055631cd1be4586fd@syzkaller.appspotmail.com
Link: https://lore.kernel.org/io-uring/0000000000003a14a905f05050b0@google.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/cancel.c