Skip to content

Commit 88e5817

Browse files
committed
Merge branch 'io_uring-6.15' into for-next
* io_uring-6.15: io_uring: don't post tag CQEs on file/buffer registration failure
2 parents 3ac6d9b + ab6005f commit 88e5817

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

io_uring/rsrc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,18 @@ void io_rsrc_cache_free(struct io_ring_ctx *ctx)
175175
io_alloc_cache_free(&ctx->imu_cache, kfree);
176176
}
177177

178+
static void io_clear_table_tags(struct io_rsrc_data *data)
179+
{
180+
int i;
181+
182+
for (i = 0; i < data->nr; i++) {
183+
struct io_rsrc_node *node = data->nodes[i];
184+
185+
if (node)
186+
node->tag = 0;
187+
}
188+
}
189+
178190
__cold void io_rsrc_data_free(struct io_ring_ctx *ctx,
179191
struct io_rsrc_data *data)
180192
{
@@ -583,6 +595,7 @@ int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
583595
io_file_table_set_alloc_range(ctx, 0, ctx->file_table.data.nr);
584596
return 0;
585597
fail:
598+
io_clear_table_tags(&ctx->file_table.data);
586599
io_sqe_files_unregister(ctx);
587600
return ret;
588601
}
@@ -902,8 +915,10 @@ int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg,
902915
}
903916

904917
ctx->buf_table = data;
905-
if (ret)
918+
if (ret) {
919+
io_clear_table_tags(&ctx->buf_table);
906920
io_sqe_buffers_unregister(ctx);
921+
}
907922
return ret;
908923
}
909924

0 commit comments

Comments
 (0)