Files
linux/io_uring
Jens Axboe 18d6b1743e io_uring/rw: check for NULL io_br_sel when putting a buffer
Both the read and write side use kiocb_done() to finish a request, and
kiocb_done() will call io_put_kbuf() in case a provided buffer was used
for the request. Provided buffers are not supported for writes, hence
NULL is being passed in. This normally works fine, as io_put_kbuf()
won't actually use the value unless REQ_F_BUFFER_RING or
REQ_F_BUFFER_SELECTED is set in the request flags. But depending on
compiler (or whether or not CONFIG_CC_OPTIMIZE_FOR_SIZE is set), that
may be done even though the value is never used. This will then cause a
NULL pointer dereference.

Make it a bit more obvious and check for a NULL io_br_sel, and don't
even bother calling io_put_kbuf() for that case.

Fixes: 5fda512554 ("io_uring/kbuf: switch to storing struct io_buffer_list locally")
Reported-by: David Howells <dhowells@redhat.com>
Tested-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-10-15 13:38:53 -06:00
..
2025-01-28 15:10:40 -07:00
2025-10-03 07:23:33 -06:00
2025-09-08 08:06:37 -06:00
2025-02-17 16:43:04 -08:00
2025-03-07 13:41:08 -07:00
2025-06-23 09:00:12 -06:00
2025-09-19 07:06:43 -06:00
2025-09-08 08:06:37 -06:00
2025-07-16 16:23:28 -06:00
2024-02-09 09:04:39 -07:00