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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319105506.383222333@linutronix.de>
Date: Wed, 19 Mar 2025 11:56:49 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Marc Zyngier <maz@...nel.org>,
 Peter Zijlstra <peterz@...radead.org>,
 Jonathan Cameron <Jonathan.Cameron@...wei.com>,
 Nishanth Menon <nm@...com>,
 Dhruva Gole <d-gole@...com>,
 Tero Kristo <kristo@...nel.org>,
 Santosh Shilimkar <ssantosh@...nel.org>,
 Logan Gunthorpe <logang@...tatee.com>,
 Dave Jiang <dave.jiang@...el.com>,
 Jon Mason <jdmason@...zu.us>,
 Allen Hubbe <allenbh@...il.com>,
 ntb@...ts.linux.dev,
 Michael Kelley <mhklinux@...look.com>,
 Wei Liu <wei.liu@...nel.org>,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Haiyang Zhang <haiyangz@...rosoft.com>,
 linux-hyperv@...r.kernel.org,
 linux-pci@...r.kernel.org,
 Wei Huang <wei.huang2@....com>,
 Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
 "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
 "Martin K. Petersen" <martin.petersen@...cle.com>,
 linux-scsi@...r.kernel.org,
 Jonathan Cameron <Jonathan.Cameron@...ei.com>
Subject: [patch V4 06/14] PCI/MSI: Set pci_dev::msi_enabled late

The comment claiming that pci_dev::msi_enabled has to be set across setup
is a leftover from ancient code versions. Nothing in the setup code
requires the flag to be set anymore.

Set it in the success path and remove the extra goto label.

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
V4: New patch
---
 drivers/pci/msi/msi.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -359,12 +359,8 @@ static int msi_capability_init(struct pc
 	if (nvec > 1 && !pci_msi_domain_supports(dev, MSI_FLAG_MULTI_PCI_MSI, ALLOW_LEGACY))
 		return 1;
 
-	/*
-	 * Disable MSI during setup in the hardware, but mark it enabled
-	 * so that setup code can evaluate it.
-	 */
+	/* Disable MSI during setup in the hardware to erase stale state */
 	pci_msi_set_enable(dev, 0);
-	dev->msi_enabled = 1;
 
 	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
@@ -372,7 +368,7 @@ static int msi_capability_init(struct pc
 	msi_lock_descs(&dev->dev);
 	ret = msi_setup_msi_desc(dev, nvec, masks);
 	if (ret)
-		goto fail;
+		goto unlock;
 
 	/* All MSIs are unmasked by default; mask them all */
 	entry = msi_first_desc(&dev->dev, MSI_DESC_ALL);
@@ -394,6 +390,7 @@ static int msi_capability_init(struct pc
 		goto err;
 
 	/* Set MSI enabled bits	*/
+	dev->msi_enabled = 1;
 	pci_intx_for_msi(dev, 0);
 	pci_msi_set_enable(dev, 1);
 
@@ -404,8 +401,6 @@ static int msi_capability_init(struct pc
 err:
 	pci_msi_unmask(&desc, msi_multi_mask(&desc));
 	pci_free_msi_irqs(dev);
-fail:
-	dev->msi_enabled = 0;
 unlock:
 	msi_unlock_descs(&dev->dev);
 	kfree(masks);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ