File 0009-fabrics-Update-controller-authentication-in-nvmf_add.patch of Package libnvme.27116
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 22 Jun 2022 12:28:00 +0200
Subject: fabrics: Update controller authentication in nvmf_add_ctrl()
Git-commit: 837b80589f9681a0161d0c9cefcee0be041eefbd
References: bsc#1201501 bsc#1201701
When calling merge_config() in nvmf_add_ctrl() the controller
authentication key can't be updated reliably as it may already
been set. So update the controller with the correct key
manually.
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
src/nvme/fabrics.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -592,8 +592,17 @@ int nvmf_add_ctrl(nvme_host_t h, nvme_ct
nvme_ctrl_get_host_iface(c),
nvme_ctrl_get_trsvcid(c),
NULL);
- if (fc)
+ if (fc) {
cfg = merge_config(c, nvme_ctrl_get_config(fc));
+ /*
+ * An authentication key might already been set
+ * in @cfg, so ensure to update @c with the correct
+ * controller key.
+ */
+ if (fc->dhchap_key)
+ nvme_ctrl_set_dhchap_key(c, fc->dhchap_key);
+ }
+
}
nvme_ctrl_set_discovered(c, true);