Skip to content

Commit 04bbe86

Browse files
dcuiLorenzo Pieralisi
authored andcommitted
PCI: hv: Fix a crash in hv_pci_restore_msi_msg() during hibernation
When a Linux VM with an assigned PCI device runs on Hyper-V, if the PCI device driver is not loaded yet (i.e. MSI-X/MSI is not enabled on the device yet), doing a VM hibernation triggers a panic in hv_pci_restore_msi_msg() -> msi_lock_descs(&pdev->dev), because pdev->dev.msi.data is still NULL. Avoid the panic by checking if MSI-X/MSI is enabled. Link: https://lore.kernel.org/r/20230816175939.21566-1-decui@microsoft.com Fixes: dc2b453 ("PCI: hv: Rework MSI handling") Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Reviewed-by: sathyanarayanan.kuppuswamy@linux.intel.com Reviewed-by: Michael Kelley <mikelley@microsoft.com> Cc: stable@vger.kernel.org
1 parent 06c2afb commit 04bbe86

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pci/controller/pci-hyperv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,6 +3983,9 @@ static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg)
39833983
struct msi_desc *entry;
39843984
int ret = 0;
39853985

3986+
if (!pdev->msi_enabled && !pdev->msix_enabled)
3987+
return 0;
3988+
39863989
msi_lock_descs(&pdev->dev);
39873990
msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
39883991
irq_data = irq_get_irq_data(entry->irq);

0 commit comments

Comments
 (0)