Message ID | 70879312-810a-49ce-aba3-fdf7f902a477@stanley.mountain (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [next] io_uring/rsrc: fix error code in io_clone_buffers() | expand |
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,
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;
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(-)