mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
io_uring: fix ignoring xa_store errors
commita528b04ea4upstream. xa_store() may fail, check the result. Cc: stable@vger.kernel.org # 5.10 Fixes:0f2122045b("io_uring: don't rely on weak ->files references") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
10e5fb03e2
commit
9f8ebecc86
@@ -8708,10 +8708,9 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx,
|
||||
static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
|
||||
{
|
||||
struct io_uring_task *tctx = current->io_uring;
|
||||
int ret;
|
||||
|
||||
if (unlikely(!tctx)) {
|
||||
int ret;
|
||||
|
||||
ret = io_uring_alloc_task_context(current);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
@@ -8722,7 +8721,12 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
|
||||
|
||||
if (!old) {
|
||||
get_file(file);
|
||||
xa_store(&tctx->xa, (unsigned long)file, file, GFP_KERNEL);
|
||||
ret = xa_err(xa_store(&tctx->xa, (unsigned long)file,
|
||||
file, GFP_KERNEL));
|
||||
if (ret) {
|
||||
fput(file);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
tctx->last = file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user