[PATCH] nvme-fabrics: restrict host_iface options match criteria
Daniel Wagner
dwagner at suse.de
Fri Jul 22 03:03:35 PDT 2022
Enforce consistent use of host_iface in setups where the hosts has
several networking interface and the target just one. That means the
user needs to set the host_iface for all connections in such
scenarios.
This keeps the match logic simple and also avoids passing in invalid
pointers to strcmp.
Fixes: 4e9499337d40 ("nvme-fabrics: consider also host_iface when checking ip options")
Signed-off-by: Daniel Wagner <dwagner at suse.de>
---
drivers/nvme/host/fabrics.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 01e96322e363..fb054929553c 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -962,7 +962,9 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl,
if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
strcmp(opts->traddr, ctrl->opts->traddr) ||
strcmp(opts->trsvcid, ctrl->opts->trsvcid) ||
- strcmp(opts->host_iface, ctrl->opts->host_iface))
+ (((opts->mask & NVMF_OPT_HOST_IFACE) &&
+ (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) &&
+ strcmp(opts->host_iface, ctrl->opts->host_iface)))
return false;
/*
--
2.37.1
More information about the Linux-nvme
mailing list