Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/rsrc: fix lost entries after cloned range

When cloning with node replacements (IORING_REGISTER_DST_REPLACE),
destination entries after the cloned range are not copied over.

Add logic to copy them over to the new destination table.

Fixes: c1329532d5aa ("io_uring/rsrc: allow cloning with node replacements")
Cc: stable@vger.kernel.org
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Joanne Koong and committed by
Jens Axboe
525916ce e29af2ab

+11 -1
+11 -1
io_uring/rsrc.c
··· 1205 1205 if (ret) 1206 1206 return ret; 1207 1207 1208 - /* Fill entries in data from dst that won't overlap with src */ 1208 + /* Copy original dst nodes from before the cloned range */ 1209 1209 for (i = 0; i < min(arg->dst_off, ctx->buf_table.nr); i++) { 1210 1210 struct io_rsrc_node *node = ctx->buf_table.nodes[i]; 1211 1211 ··· 1236 1236 } 1237 1237 data.nodes[off++] = dst_node; 1238 1238 i++; 1239 + } 1240 + 1241 + /* Copy original dst nodes from after the cloned range */ 1242 + for (i = nbufs; i < ctx->buf_table.nr; i++) { 1243 + struct io_rsrc_node *node = ctx->buf_table.nodes[i]; 1244 + 1245 + if (node) { 1246 + data.nodes[i] = node; 1247 + node->refs++; 1248 + } 1239 1249 } 1240 1250 1241 1251 /*