Skip to content

Commit 5218d5c

Browse files
isilencegregkh
authored andcommitted
io_uring: zero tag on rsrc removal
[ Upstream commit 8f0a248 ] Automatically default rsrc tag in io_queue_rsrc_removal(), it's safer than leaving it there and relying on the rest of the code to behave and not use it. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/1cf262a50df17478ea25b22494dcc19f3a80301f.1649336342.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent efb0209 commit 5218d5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/io_uring.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8413,13 +8413,15 @@ static int io_sqe_file_register(struct io_ring_ctx *ctx, struct file *file,
84138413
static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
84148414
struct io_rsrc_node *node, void *rsrc)
84158415
{
8416+
u64 *tag_slot = io_get_tag_slot(data, idx);
84168417
struct io_rsrc_put *prsrc;
84178418

84188419
prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
84198420
if (!prsrc)
84208421
return -ENOMEM;
84218422

8422-
prsrc->tag = *io_get_tag_slot(data, idx);
8423+
prsrc->tag = *tag_slot;
8424+
*tag_slot = 0;
84238425
prsrc->rsrc = rsrc;
84248426
list_add(&prsrc->list, &node->rsrc_list);
84258427
return 0;

0 commit comments

Comments
 (0)