diff options
author | Caleb Sander Mateos <csander@purestorage.com> | 2025-02-16 15:58:59 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-02-17 05:34:46 -0700 |
commit | 496f56bf9f1acf11ce14489f34d81ba6e4023f42 (patch) | |
tree | f8da87b2b602e4d6a2badcd345dc0b4ac1402fb3 /io_uring/splice.c | |
parent | 60e6ce746bfcbe7541c205085c11ce0ff2ffd014 (diff) |
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>
Diffstat (limited to 'io_uring/splice.c')
-rw-r--r-- | io_uring/splice.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/io_uring/splice.c b/io_uring/splice.c index 5b84f1630611..7b89bd84d486 100644 --- a/io_uring/splice.c +++ b/io_uring/splice.c @@ -51,7 +51,8 @@ void io_splice_cleanup(struct io_kiocb *req) { struct io_splice *sp = io_kiocb_to_cmd(req, struct io_splice); - io_put_rsrc_node(req->ctx, sp->rsrc_node); + if (sp->rsrc_node) + io_put_rsrc_node(req->ctx, sp->rsrc_node); } static struct file *io_splice_get_file(struct io_kiocb *req, |