[PATCH v2] nvme-tcp: fix NULL queue->ctrl dereference on reconnect

Nilay Shroff nilay at linux.ibm.com
Tue Oct 27 23:20:02 PDT 2026


On 10/28/26 8:13 AM, Christian Aurich Zanettini Martins wrote:
> Since commit 61b0ed3be81b ("nvme-tcp: parallelize I/O queue allocation
> and startup"), a reconnect that gets more I/O queues than before grows
> the tag set before the new queues are allocated. queue->ctrl is only
> set by nvme_tcp_alloc_queue(), so I/O submitted in between reaches
> nvme_tcp_queue_rq() on a queue that was never allocated and
> dereferences a NULL queue->ctrl:
> 
>    BUG: kernel NULL pointer dereference, address: 00000000000002ac
>    RIP: 0010:nvme_tcp_queue_rq+0x33/0x3b0
> 
> Add nvme_tcp_init_queue() for the queue fields that do not depend on
> the connection and call it for every queue when allocating the
> controller. Such requests are then requeued like on any other queue
> that is not live. send_mutex and io_work move there as well, and the
> helper's mutexes are all destroyed when the controller is freed, like
> queue_lock already is.
> 
> Fixes: 61b0ed3be81b ("nvme-tcp: parallelize I/O queue allocation and startup")
> Suggested-by: Keith Busch<kbusch at kernel.org>
> Signed-off-by: Christian Aurich Zanettini Martins<christian.aurichzm at gmail.com>

Looks good to me.
Reviewed-by: Nilay Shroff <nilay at linux.ibm.com>



More information about the Linux-nvme mailing list