[PATCH 3/4] nvme-fabrics: make call to nvme_auth_extract_key() conditional
Hannes Reinecke
hare at kernel.org
Wed Oct 1 08:13:50 PDT 2025
nvme_auth_extract_key() is only available if the authentication
code is compiled in, so make it condititional on the config option.
Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202509302359.TL1868ni-lkp@intel.com/
Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
drivers/nvme/host/fabrics.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 3d4d6d8e88c4..67b2ad5ae0fd 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -1106,6 +1106,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
}
if (host_secret) {
+#ifdef CONFIG_NVME_HOST_AUTH
pr_debug("lookup host identity '%s'\n", host_secret);
key = nvme_auth_extract_key(opts->keyring, host_secret,
strlen(host_secret),
@@ -1116,8 +1117,13 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
}
pr_debug("using dhchap key %08x\n", key_serial(key));
opts->dhchap_key = key;
+#else
+ ret = -EINVAL;
+ goto out;
+#endif
}
if (ctrl_secret) {
+#ifdef CONFIG_NVME_HOST_AUTH
if (!opts->dhchap_key) {
ret = -EINVAL;
goto out;
@@ -1132,6 +1138,10 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
}
pr_debug("using dhchap ctrl key %08x\n", key_serial(key));
opts->dhchap_ctrl_key = key;
+#else
+ ret = -EINVAL;
+ goto out;
+#endif
}
if (opts->concat) {
--
2.43.0
More information about the Linux-nvme
mailing list