aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsrael Rukshin <israelr@mellanox.com>2018-06-10 06:31:10 -0400
committerChristoph Hellwig <hch@lst.de>2018-06-11 10:17:41 -0400
commit16001c10725e11b73b8518f42e414506bf73c291 (patch)
treef24a46cc72411e71324c7f83951e0dfb93d57a99
parent190b02ed79e08983bf62d47c05945c1b06a3d7d5 (diff)
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@mellanox.com> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e2dcd14012b1..d6ca4598c027 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2208,7 +2208,7 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
2208 * Verify that the subsystem actually supports multiple 2208 * Verify that the subsystem actually supports multiple
2209 * controllers, else bail out. 2209 * controllers, else bail out.
2210 */ 2210 */
2211 if (!ctrl->opts->discovery_nqn && 2211 if (!(ctrl->opts && ctrl->opts->discovery_nqn) &&
2212 nvme_active_ctrls(found) && !(id->cmic & (1 << 1))) { 2212 nvme_active_ctrls(found) && !(id->cmic & (1 << 1))) {
2213 dev_err(ctrl->device, 2213 dev_err(ctrl->device,
2214 "ignoring ctrl due to duplicate subnqn (%s).\n", 2214 "ignoring ctrl due to duplicate subnqn (%s).\n",