lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 12 Jul 2022 15:24:48 +0800 From: Kai-Heng Feng <kai.heng.feng@...onical.com> To: bhelgaas@...gle.com Cc: Kai-Heng Feng <kai.heng.feng@...onical.com>, Thomas Gleixner <tglx@...utronix.de>, Jason Gunthorpe <jgg@...pe.ca>, Marc Zyngier <maz@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org Subject: [PATCH] PCI/MSI: Clear MSI/MSI-X on resume if it's not enabled MSI/MSI-X can have garbage data after system resume. Before suspend: Capabilities: [a0] MSI: Enable- Count=1/4 Maskable- 64bit+ Address: 0000000000000000 Data: 0000 Capabilities: [c0] MSI-X: Enable+ Count=4 Masked- Vector table: BAR=5 offset=00042000 PBA: BAR=5 offset=00043000 After resume: Capabilities: [a0] MSI: Enable+ Count=128/4 Maskable- 64bit+ Address: fffffffffffffffc Data: ffff Capabilities: [c0] MSI-X: Enable+ Count=4 Masked- Vector table: BAR=5 offset=00042000 PBA: BAR=5 offset=00043000 So clear the MSI/MSI-X config on resume to ensure it's not enabled unintentionally. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216242 Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com> --- drivers/pci/msi/msi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 9037a7827eca7..cf8374a877f3f 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -263,8 +263,12 @@ static void __pci_restore_msi_state(struct pci_dev *dev) struct msi_desc *entry; u16 control; - if (!dev->msi_enabled) + if (!dev->msi_enabled) { + if (dev->msi_cap) + pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, 0); + return; + } entry = irq_get_msi_desc(dev->irq); @@ -295,8 +299,12 @@ static void __pci_restore_msix_state(struct pci_dev *dev) struct msi_desc *entry; bool write_msg; - if (!dev->msix_enabled) + if (!dev->msix_enabled) { + if (dev->msix_cap) + pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, 0); + return; + } /* route the table */ pci_intx_for_msi(dev, 0); -- 2.36.1
Powered by blists - more mailing lists