OSDN Git Service

io_uring: prevent racy sqd->thread checks
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 11 Mar 2021 23:29:37 +0000 (23:29 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Mar 2021 16:42:53 +0000 (09:42 -0700)
commit26984fbf3ad9d1c1fb56a0c1e0cdf9fa3b806f0c
tree2b70bcfbf5b5f9605ff37c55ff938d98a44edc35
parent0df8ea602b3fe80819a34361027ad40485e78909
io_uring: prevent racy sqd->thread checks

SQPOLL thread to which we're trying to attach may be going away, it's
not nice but a more serious problem is if io_sq_offload_create() sees
sqd->thread==NULL, and tries to init it with a new thread. There are
tons of ways it can be exploited or fail.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c