Skip to content

Commit 858e686

Browse files
committed
io_uring/rsrc: ignore dummy_ubuf for buffer cloning
For placeholder buffers, &dummy_ubuf is assigned which is a static value. When buffers are attempted cloned, don't attempt to grab a reference to it, as we both don't need it and it'll actively fail as dummy_ubuf doesn't have a valid reference count setup. Link: https://lore.kernel.org/io-uring/Zw8dkUzsxQ5LgAJL@ly-workstation/ Reported-by: Lai, Yi <[email protected]> Fixes: 7cc2a6e ("io_uring: add IORING_REGISTER_COPY_BUFFERS method") Signed-off-by: Jens Axboe <[email protected]>
1 parent 28aabff commit 858e686

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

io_uring/rsrc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,8 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
11761176
for (i = 0; i < nbufs; i++) {
11771177
struct io_mapped_ubuf *src = src_ctx->user_bufs[i];
11781178

1179-
refcount_inc(&src->refs);
1179+
if (src != &dummy_ubuf)
1180+
refcount_inc(&src->refs);
11801181
user_bufs[i] = src;
11811182
}
11821183

0 commit comments

Comments
 (0)