io_uring/rsrc: zero node's rsrc data on alloc
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 11 Apr 2023 11:06:06 +0000 (12:06 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Apr 2023 18:09:41 +0000 (12:09 -0600)
struct io_rsrc_node::rsrc_data field is initialised on rsrc removal and
shouldn't be used before that, still let's play safe and zero the field
on alloc.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/09bd03cedc8da8a7974c5e6e4bf0489fd16593ab.1681210788.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rsrc.c

index 73f9e10d9bf0f07b41654d0cadbbd5c0e8225dc5..329cc3851dfdb89c2e6f7f7a73f8b96f3e684133 100644 (file)
@@ -218,6 +218,7 @@ static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx)
                        return NULL;
        }
 
+       ref_node->rsrc_data = NULL;
        ref_node->refs = 1;
        INIT_LIST_HEAD(&ref_node->node);
        INIT_LIST_HEAD(&ref_node->item_list);