Skip to content

Commit a5bdd51

Browse files
author
Ming Lei
committed
io_uring/rsrc: don't put/free empty buffers
JIRA: https://issues.redhat.com/browse/RHEL-106845 commit 99d6af6 Author: Jens Axboe <[email protected]> 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 <[email protected]> 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 <[email protected]> Signed-off-by: Ming Lei <[email protected]>
1 parent 642373b commit a5bdd51

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
@@ -1043,8 +1043,10 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
10431043
out_put_free:
10441044
i = data.nr;
10451045
while (i--) {
1046-
io_buffer_unmap(src_ctx, data.nodes[i]);
1047-
kfree(data.nodes[i]);
1046+
if (data.nodes[i]) {
1047+
io_buffer_unmap(src_ctx, data.nodes[i]);
1048+
kfree(data.nodes[i]);
1049+
}
10481050
}
10491051
out_unlock:
10501052
io_rsrc_data_free(ctx, &data);

0 commit comments

Comments
 (0)