Skip to content

Commit 0b2ca2c

Browse files
niklas88hcahca
authored andcommitted
s390/pci: fix hot-plug of PCI function missing bus
Under some circumstances in particular with "Reconfigure I/O Path" a zPCI function may first appear in Standby through a PCI event with PEC 0x0302 which initially makes it visible to the zPCI subsystem, Only after that is it configured with a zPCI event with PEC 0x0301. If the zbus is still missing a PCI function zero (devfn == 0) when the PCI event 0x0301 is handled zdev->zbus->bus is still NULL and gets dereferenced in common code. Check for this case and enable but don't scan the zPCI function. This matches what would happen if we immediately got the 0x0301 configuration request or the function was included in CLP List PCI. In all cases the PCI functions with devfn != 0 will be scanned once function 0 appears. Fixes: 3047766 ("s390/pci: fix enabling a reserved PCI function") Cc: <stable@vger.kernel.org> # 5.8 Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Acked-by: Pierre Morel <pmorel@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent de5d9da commit 0b2ca2c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/s390/pci/pci_event.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
101101
if (ret)
102102
break;
103103

104+
/* the PCI function will be scanned once function 0 appears */
105+
if (!zdev->zbus->bus)
106+
break;
107+
104108
pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
105109
if (!pdev)
106110
break;

0 commit comments

Comments
 (0)