Skip to content

Commit 837b805

Browse files
committed
fabrics: Update controller authentication in nvmf_add_ctrl()
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 <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 13fe110 commit 837b805

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/nvme/fabrics.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,17 @@ int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
596596
nvme_ctrl_get_host_iface(c),
597597
nvme_ctrl_get_trsvcid(c),
598598
NULL);
599-
if (fc)
599+
if (fc) {
600600
cfg = merge_config(c, nvme_ctrl_get_config(fc));
601+
/*
602+
* An authentication key might already been set
603+
* in @cfg, so ensure to update @c with the correct
604+
* controller key.
605+
*/
606+
if (fc->dhchap_key)
607+
nvme_ctrl_set_dhchap_key(c, fc->dhchap_key);
608+
}
609+
601610
}
602611

603612
nvme_ctrl_set_discovered(c, true);

0 commit comments

Comments
 (0)