]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
io_uring/rsrc: skip NULL file/buffer checks in io_free_rsrc_node()
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 28 Feb 2025 23:59:14 +0000 (16:59 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Mar 2025 14:17:15 +0000 (07:17 -0700)
io_rsrc_node's of type IORING_RSRC_FILE always have a file attached
immediately after they are allocated. IORING_RSRC_BUFFER nodes won't be
returned from io_sqe_buffer_register()/io_buffer_register_bvec() until
they have a io_mapped_ubuf attached.

So remove the checks for a NULL file/buffer in io_free_rsrc_node().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Link: https://lore.kernel.org/r/20250228235916.670437-5-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rsrc.c

index 806f2c1f5d2e356d1d3a66cc366294814221d8a1..3fb1bd616eef7ca7d662f365f3fc2695c0a331a1 100644 (file)
@@ -500,12 +500,10 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
 
        switch (node->type) {
        case IORING_RSRC_FILE:
-               if (io_slot_file(node))
-                       fput(io_slot_file(node));
+               fput(io_slot_file(node));
                break;
        case IORING_RSRC_BUFFER:
-               if (node->buf)
-                       io_buffer_unmap(ctx, node->buf);
+               io_buffer_unmap(ctx, node->buf);
                break;
        default:
                WARN_ON_ONCE(1);