OSDN Git Service

io_uring: fail io_uring_register(2) on a dying io_uring instance
authorJens Axboe <axboe@kernel.dk>
Mon, 22 Apr 2019 16:23:23 +0000 (10:23 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 22 Apr 2019 16:37:07 +0000 (10:37 -0600)
commit35fa71a030caa50458a043560d4814ea9bcd639f
treef40aab4ff93b1443117ce1ed87a63c6ebd0dda2b
parent085b7755808aa11f78ab9377257e1dad2e6fa4bb
io_uring: fail io_uring_register(2) on a dying io_uring instance

If we have multiple threads doing io_uring_register(2) on an io_uring
fd, then we can potentially try and kill the percpu reference while
someone else has already killed it.

Prevent this race by failing io_uring_register(2) if the ref is marked
dying. This is safe since we're inside the io_uring mutex.

Fixes: b19062a56726 ("io_uring: fix possible deadlock between io_uring_{enter,register}")
Reported-by: syzbot <syzbot+10d25e23199614b7721f@syzkaller.appspotmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c