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@xxxxxxxxxx> --- 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