mirror of
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10.git
synced 2026-09-09 00:07:04 +08:00
io_uring/rsrc: avoid NULL check in io_put_rsrc_node()
JIRA: https://issues.redhat.com/browse/RHEL-106845 commit 496f56bf9f1acf11ce14489f34d81ba6e4023f42 Author: Caleb Sander Mateos <csander@purestorage.com> Date: Sun Feb 16 15:58:59 2025 -0700 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> Signed-off-by: Ming Lei <ming.lei@redhat.com>
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ static inline struct io_rsrc_node *io_rsrc_node_lookup(struct io_rsrc_data *data
|
||||
static inline void io_put_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
|
||||
{
|
||||
lockdep_assert_held(&ctx->uring_lock);
|
||||
if (node && !--node->refs)
|
||||
if (!--node->refs)
|
||||
io_free_rsrc_node(ctx, node);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ void io_splice_cleanup(struct io_kiocb *req)
|
||||
{
|
||||
struct io_splice *sp = io_kiocb_to_cmd(req, struct io_splice);
|
||||
|
||||
if (sp->rsrc_node)
|
||||
io_put_rsrc_node(req->ctx, sp->rsrc_node);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user