]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
nvme: fix NULL pointer dereference in nvme_init_subsystem
authorIsrael Rukshin <israelr@mellanox.com>
Sun, 10 Jun 2018 10:31:10 +0000 (10:31 +0000)
committerChristoph Hellwig <hch@lst.de>
Mon, 11 Jun 2018 14:17:41 +0000 (16:17 +0200)
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>
drivers/nvme/host/core.c

index e2dcd14012b19669f94c4eea07bb047c7df2e76a..d6ca4598c0279d6871c163270250b229fb4ae8af 100644 (file)
@@ -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",