Re: [PATCH] nvme: auth: validate DHCHAP secret before stopping authentication
From: Sreeraj S Kurup
Date: Sat Oct 03 2026 - 09:10:05 EST
Hi Hannes,
Yes, I agree that stopping the currently running authentication when the admin requests a new one is intentional.
The issue I was pointing out is slightly different: if the new key is invalid, we never actually get to the point where the new authentication can be started again. "nvme_auth_stop()" has already stopped the existing authentication, and the parser returns an error before the restart path is reached.
So the question is whether writing an invalid replacement key should leave the previous authentication stopped, or whether the key should first be parsed/validated and only then replace the existing authentication state.
If the intended semantics are that an invalid key write should not disturb an already running authentication, then moving the validation before "nvme_auth_stop()" would make the operation effectively transactional:
validate new key
-> error: leave existing authentication unchanged
-> success: stop old authentication and start with new key
If, however, the intended semantics are that any attempted replacement stops the existing authentication even when the replacement is invalid, then I agree that the current behaviour is intentional and the patch doesn't fix a bug.
My concern was specifically the former behaviour, rather than "nvme_auth_stop()" itself.
Cheers,
Sreeraj