Skip to content

Commit 6f01bdb

Browse files
committed
nvme-pci: allocate tagset on reset if necessary
If a drive is unable to create IO queues on the initial probe, a subsequent reset will need to allocate the tagset if IO queue creation is successful. Without this, blk_mq_update_nr_hw_queues will crash on a bad pointer due to the invalid tagset. Fixes: eac3ef2 ("nvme-pci: split the initial probe from the rest path") Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 5572a55 commit 6f01bdb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/nvme/host/pci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,12 @@ static unsigned int nvme_pci_nr_maps(struct nvme_dev *dev)
25082508

25092509
static void nvme_pci_update_nr_queues(struct nvme_dev *dev)
25102510
{
2511+
if (!dev->ctrl.tagset) {
2512+
nvme_alloc_io_tag_set(&dev->ctrl, &dev->tagset, &nvme_mq_ops,
2513+
nvme_pci_nr_maps(dev), sizeof(struct nvme_iod));
2514+
return;
2515+
}
2516+
25112517
blk_mq_update_nr_hw_queues(&dev->tagset, dev->online_queues - 1);
25122518
/* free previously allocated queues that are no longer usable */
25132519
nvme_free_queues(dev, dev->online_queues);

0 commit comments

Comments
 (0)