Skip to content

Commit aa7c00f

Browse files
committed
io_uring/rsrc: don't put/free empty buffers
JIRA: https://issues.redhat.com/browse/RHEL-105612 commit 99d6af6 Author: Jens Axboe <axboe@kernel.dk> Date: Thu Dec 12 08:01:52 2024 -0700 io_uring/rsrc: don't put/free empty buffers If cloning of buffers fail and we have to put the ones already grabbed, check for NULL buffers and skip those. They used to be dummy ubufs, but now they are just NULL and that should be checked before reaping them. Reported-by: chase xd <sl1589472800@gmail.com> Link: https://lore.kernel.org/io-uring/CADZouDQ7TcKn8gz8_efnyAEp1JvU1ktRk8PWz-tO0FXUoh8VGQ@mail.gmail.com/ Fixes: d50f94d ("io_uring/rsrc: get rid of the empty node and dummy_ubuf") Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
1 parent 0f864fe commit aa7c00f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

io_uring/rsrc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,10 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
10361036
out_put_free:
10371037
i = data.nr;
10381038
while (i--) {
1039-
io_buffer_unmap(src_ctx, data.nodes[i]);
1040-
kfree(data.nodes[i]);
1039+
if (data.nodes[i]) {
1040+
io_buffer_unmap(src_ctx, data.nodes[i]);
1041+
kfree(data.nodes[i]);
1042+
}
10411043
}
10421044
out_unlock:
10431045
io_rsrc_data_free(ctx, &data);

0 commit comments

Comments
 (0)