Skip to content

Commit

Permalink
nvme: setup streams after initializing namespace head
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Keith Busch authored and Christoph Hellwig committed Dec 15, 2017
1 parent 249159c commit 654b4a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
/*
Expand Down

0 comments on commit 654b4a4

Please sign in to comment.