]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nvme: setup streams after initializing namespace head
authorKeith Busch <keith.busch@intel.com>
Thu, 14 Dec 2017 18:20:32 +0000 (11:20 -0700)
committerChristoph Hellwig <hch@lst.de>
Fri, 15 Dec 2017 14:18:07 +0000 (15:18 +0100)
Fixes a NULL pointer dereference.

Reported-by: Arnav Dawn <a.dawn@samsung.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c

index eab812dd2429f2db0abbe662c265377aa4c228b1..1e46e60b8f1080e339ebe81c1710dabb23afef75 100644 (file)
@@ -2870,7 +2870,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
 
        blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
        nvme_set_queue_limits(ctrl, ns->queue);
-       nvme_setup_streams_ns(ctrl, ns);
 
        id = nvme_identify_ns(ctrl, nsid);
        if (!id)
@@ -2881,6 +2880,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
 
        if (nvme_init_ns_head(ns, nsid, id, &new))
                goto out_free_id;
+       nvme_setup_streams_ns(ctrl, ns);
        
 #ifdef CONFIG_NVME_MULTIPATH
        /*