[PATCH] nvme: split host and target nvme_auth_extract_key

Christoph Hellwig hch at lst.de
Wed Oct 29 23:01:55 PDT 2025


On Wed, Oct 29, 2025 at 07:57:45AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
> 
> The host and target share common code, but the config allows you to
> disable support for one and not the other. When support is disabled, a
> stub implementation needs to be used, but that would clash with the real
> implementation that the other relies on.
> 
> Split the host and target implementations into uniquely named stub
> functions that either call the real implementation or return an error if
> their config option is disabled.
> 
> Fixes: f59ae5c9e356b5e ("nvme: parse dhchap keys during option parsing")
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202510100105.cibujuUJ-lkp@intel.com/
> Signed-off-by: Keith Busch <kbusch at kernel.org>

This seems a bit backwards.  How about dropping the stub entirely
and guard the calls with IS_ENABLED or if needed ifdefs instead?

> -	key = nvme_auth_extract_key(host->dhchap_keyring, secret, len, &generated);
> +	key = nvme_auth_extract_key_target(host->dhchap_keyring, secret, len, &generated);

And maybe fix the (pre-existing) overly long line here if you end up
touching this.



More information about the Linux-nvme mailing list