Skip to content

Commit be7837e

Browse files
committed
NVMe: fail pci initialization if the device doesn't have any BARs
The PCI init of NVMe doesn't check for valid bars before proceeding to map and use BAR 0. If the device is hosed (or firmware is), then we should catch this case and give up early. This fixes a: [ 1662.035778] WARNING: CPU: 0 PID: 4 at arch/x86/mm/ioremap.c:63 __ioremap_check_ram+0xa7/0xc0() and later badness on such a device. Acked-by: Keith Busch <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 2c30540 commit be7837e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/block/nvme-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,9 @@ static int nvme_dev_map(struct nvme_dev *dev)
21562156
dev->entry[0].vector = pdev->irq;
21572157
pci_set_master(pdev);
21582158
bars = pci_select_bars(pdev, IORESOURCE_MEM);
2159+
if (!bars)
2160+
goto disable_pci;
2161+
21592162
if (pci_request_selected_regions(pdev, bars, "nvme"))
21602163
goto disable_pci;
21612164

0 commit comments

Comments
 (0)