[PATCH next] io_uring/rsrc: fix error code in io_clone_buffers()

Dan Carpenter posted 1 patch 3 weeks, 4 days ago
io_uring/rsrc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH next] io_uring/rsrc: fix error code in io_clone_buffers()
Posted by Dan Carpenter 3 weeks, 4 days ago
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@linaro.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
Re: [PATCH next] io_uring/rsrc: fix error code in io_clone_buffers()
Posted by Jens Axboe 3 weeks, 4 days ago
On Wed, 30 Oct 2024 12:55:06 +0300, Dan Carpenter wrote:
> Return -ENOMEM if the allocation fails.  Don't return success.
> 
> 

Applied, thanks!

[1/1] io_uring/rsrc: fix error code in io_clone_buffers()
      commit: 0f576012ae2ff08009ce91e2294832e2b88aba06

Best regards,
-- 
Jens Axboe