[PATCH v2 3/5] nvme-auth: fix data race on ctrl->transaction

Keith Busch kbusch at kernel.org
Mon Nov 9 09:10:41 PST 2026


On Mon, Nov 09, 2026 at 10:26:44AM +0800, Guixin Liu wrote:
> The controller side only echoes the transaction id within a queue, so
> the race has no functional impact today, but the increment is still
> unsynchronized and KCSAN reports it. 

So it's not a bug with any user observable behavior; it's just
unexpected. It sounds like the "transaction" value doesn't need to be
unique across queues. If it doesn't need to be unique at the "ctrl"
scope, then I'm not seeing any benefit to imposing that rule on the
driver.

> -	chap->transaction = ctrl->transaction++;
> +	chap->transaction = (u16)atomic_inc_return(&ctrl->transaction);

Can we just change this to:

	chap->transaction++;

? And delete the value reset in nvme_auth_reset_dhchap? You can also
delete the "transaction" field from the nvme_ctrl struct.



More information about the Linux-nvme mailing list