Skip to content

Commit

Permalink
io_uring/rsrc: don't put/free empty buffers
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
axboe committed Dec 12, 2024
1 parent a07d2d7 commit 99d6af6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,10 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
out_put_free:
i = data.nr;
while (i--) {
io_buffer_unmap(src_ctx, data.nodes[i]);
kfree(data.nodes[i]);
if (data.nodes[i]) {
io_buffer_unmap(src_ctx, data.nodes[i]);
kfree(data.nodes[i]);
}
}
out_unlock:
io_rsrc_data_free(ctx, &data);
Expand Down

0 comments on commit 99d6af6

Please sign in to comment.