[PATCH v4] nvme-tcp: Validate the queue state under the queue lock in the address attribute
Keith Busch
kbusch at kernel.org
Wed Oct 28 08:38:23 PDT 2026
On Wed, Oct 28, 2026 at 10:09:04AM +0800, Guixin Liu wrote:
> Reading the "address" sysfs attribute calls kernel_getsockname() on the
> admin queue socket, which can race with the queue teardown during
> connection error recovery: a reader can observe NVME_TCP_Q_LIVE set,
> then block on the queue lock while nvme_tcp_free_queue() releases the
> socket and clears queue->sock without holding the lock. Once the
> reader acquires the lock it dereferences the NULL socket pointer.
>
> Commit 76d54bf20cdc ("nvme-tcp: don't access released socket during
> error recovery") had the queue liveness check inside the lock.
> Commit 782373ba2766 ("nvme: tcp: avoid race between queue_lock lock
> and destroy") moved it back out because the lock itself is destroyed
> in nvme_tcp_free_queue(), so a reader arriving late trips
> mutex_destroy().
Thanks, applied to nvme-7.4.
More information about the Linux-nvme
mailing list