[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <70879312-810a-49ce-aba3-fdf7f902a477@stanley.mountain>
Date: Wed, 30 Oct 2024 12:55:06 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Jens Axboe <axboe@...nel.dk>
Cc: Pavel Begunkov <asml.silence@...il.com>, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH next] io_uring/rsrc: fix error code in io_clone_buffers()
Return -ENOMEM if the allocation fails. Don't return success.
Fixes: c0b9c5097cbc ("io_uring/rsrc: unify file and buffer resource tables")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
io_uring/rsrc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 784fd1ca6031..f317f39e8b95 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -977,8 +977,10 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
dst_node = rsrc_empty_node;
} else {
dst_node = io_rsrc_node_alloc(ctx, &data, index, IORING_RSRC_BUFFER);
- if (!dst_node)
+ if (!dst_node) {
+ ret = -ENOMEM;
goto out_put_free;
+ }
refcount_inc(&src_node->buf->refs);
dst_node->buf = src_node->buf;
--
2.45.2
Powered by blists - more mailing lists