diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-12-03 18:37:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-12-13 20:45:20 +0300 |
commit | 30df2901c4aca373c1a5e38f2b59bb5a1bd38674 (patch) | |
tree | 07da89c65fd6f7d99c32cf5e51477fbad1f81104 /arch/xtensa | |
parent | dd864f6ee04e82667bce667ef896a4f25a59db07 (diff) | |
download | linux-30df2901c4aca373c1a5e38f2b59bb5a1bd38674.tar.xz |
io_uring: fix mutex_unlock with unreferenced ctx
commit f7b32e785042d2357c5abc23ca6db1b92c91a070 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/xtensa')
0 files changed, 0 insertions, 0 deletions