Skip to contentSkip to conversation

nvme: Fix NULL pointer dereference in nvme_init_subsystem

PATCH New Israel Rukshin 2 participants 2 messages Jun 10, 2018 – Jun 11, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Fix NULL pointer dereference in nvme_init_subsystem

When using nvme-pci driver the nvmf_ctrl_options is NULL.
There is no need to check for discovery_nqn flag at non-fabrics controller.

Fixes 181303d0 ("nvme-fabrics: allow duplicate connections to the discovery controller")
Signed-off-by Israel Rukshin <israelr at mellanox.com>
Reviewed-by Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index c8b3006..0ab4c7a 100644
@@ -2208,7 +2208,7 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 		 * Verify that the subsystem actually supports multiple
 		 * controllers, else bail out.
 		 */
-		if (!ctrl->opts->discovery_nqn &&
+		if (!(ctrl->opts && ctrl->opts->discovery_nqn) &&
 		    nvme_active_ctrls(found) && !(id->cmic & (1 << 1))) {
 			dev_err(ctrl->device,
 				"ignoring ctrl due to duplicate subnqn (%s).\n",
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw

PATCH 1/1 nvme: Fix NULL pointer dereference in nvme_init_subsystem

Thanks,

applied to nvme-4.18.