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: avoid NULL check in io_put_rsrc_node()

Most callers of io_put_rsrc_node() already check that node is non-NULL:
- io_rsrc_data_free()
- io_sqe_buffer_register()
- io_reset_rsrc_node()
- io_req_put_rsrc_nodes() (REQ_F_BUF_NODE indicates non-NULL buf_node)

Only io_splice_cleanup() can call io_put_rsrc_node() with a NULL node.
So move the NULL check there.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Link: https://lore.kernel.org/r/20250216225900.1075446-1-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
496f56bf 60e6ce74

+3 -2
+1 -1
io_uring/rsrc.h
··· 83 83 static inline void io_put_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) 84 84 { 85 85 lockdep_assert_held(&ctx->uring_lock); 86 - if (node && !--node->refs) 86 + if (!--node->refs) 87 87 io_free_rsrc_node(ctx, node); 88 88 } 89 89
+2 -1
io_uring/splice.c
··· 51 51 { 52 52 struct io_splice *sp = io_kiocb_to_cmd(req, struct io_splice); 53 53 54 - io_put_rsrc_node(req->ctx, sp->rsrc_node); 54 + if (sp->rsrc_node) 55 + io_put_rsrc_node(req->ctx, sp->rsrc_node); 55 56 } 56 57 57 58 static struct file *io_splice_get_file(struct io_kiocb *req,