Skip to content

Commit 99d6af6

Browse files
committed
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>
1 parent a07d2d7 commit 99d6af6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

io_uring/rsrc.c

+4-2
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)