]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: Check current->io_uring in io_uring_cancel_sqpoll
authorPalash Oswal <hello@oswalpalash.com>
Tue, 27 Apr 2021 12:51:49 +0000 (18:21 +0530)
committerJens Axboe <axboe@kernel.dk>
Tue, 27 Apr 2021 13:37:39 +0000 (07:37 -0600)
commit1e418aadb1acf9c35f59104bb3c8afbe2b3a5b49
treec6b857d10a645b11e5f3c5ebbce5acf227dc64dd
parent2da0af13b676357591d8da9948f838b9f887c772
io_uring: Check current->io_uring in io_uring_cancel_sqpoll

syzkaller identified KASAN: null-ptr-deref Write in
io_uring_cancel_sqpoll.

io_uring_cancel_sqpoll is called by io_sq_thread before calling
io_uring_alloc_task_context. This leads to current->io_uring being NULL.
io_uring_cancel_sqpoll should not have to deal with threads where
current->io_uring is NULL.

In order to cast a wider safety net, perform input sanitisation directly
in io_uring_cancel_sqpoll and return for NULL value of current->io_uring.
This is safe since if current->io_uring isn't set, then there's no way
for the task to have submitted any requests.

Reported-by: syzbot+be51ca5a4d97f017cd50@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Palash Oswal <hello@oswalpalash.com>
Link: https://lore.kernel.org/r/20210427125148.21816-1-hello@oswalpalash.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c