diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-12-03 15:37:53 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-12-03 19:09:28 -0700 |
commit | f7b32e785042d2357c5abc23ca6db1b92c91a070 (patch) | |
tree | 0a06a82fbfd4f58f40b49ba689d1c5aa43ca4aa3 /lib/fw_table.c | |
parent | 73363c262d6a7d26063da96610f61baf69a70f7c (diff) | |
download | linux-f7b32e785042d2357c5abc23ca6db1b92c91a070.tar.gz linux-f7b32e785042d2357c5abc23ca6db1b92c91a070.tar.bz2 linux-f7b32e785042d2357c5abc23ca6db1b92c91a070.zip |
io_uring: fix mutex_unlock with unreferenced ctx
Callers of mutex_unlock() have to make sure that the mutex stays alive
for the whole duration of the function call. For io_uring that means
that the following pattern is not valid unless we ensure that the
context outlives the mutex_unlock() call.
mutex_lock(&ctx->uring_lock);
req_put(req); // typically via io_req_task_submit()
mutex_unlock(&ctx->uring_lock);
Most contexts are fine: io-wq pins requests, syscalls hold the file,
task works are taking ctx references and so on. However, the task work
fallback path doesn't follow the rule.
Cc: <stable@vger.kernel.org>
Fixes: 04fc6c802d ("io_uring: save ctx put/get for task_work submit")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/io-uring/CAG48ez3xSoYb+45f1RLtktROJrpiDQ1otNvdR+YLQf7m+Krj5Q@mail.gmail.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib/fw_table.c')
0 files changed, 0 insertions, 0 deletions