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-next>] [day] [month] [year] [list]
Message-ID: <20240523103430.423340-1-jorge.sanjuangarcia@duagon.com>
Date: Thu, 23 May 2024 10:35:03 +0000
From: Sanjuán García, Jorge
	<Jorge.SanjuanGarcia@...gon.com>
To: "morbidrsa@...il.com" <morbidrsa@...il.com>, "gregkh@...uxfoundation.org"
	<gregkh@...uxfoundation.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"jth@...nel.org" <jth@...nel.org>,
	Rodríguez Barbarin, José Javier
	<josejavier.rodriguez@...gon.com>,
	Sanjuán García, Jorge
	<Jorge.SanjuanGarcia@...gon.com>,
	Rodríguez Barbarin, José Javier
	<josejavier.rodriguez@...gon.com>
Subject: [PATCH RESEND] mcb: mcb-pci: detect IO mapped devices before
 requesting resources

If the memory region is requested with devm_request_mem_region()
for an IO mapped device it will return an error and mcb-pci will
incorrectly report it with EBUSY code.

Make sure we identify if the reosure is IO mapped and fail early
with a correct ENOTSUPP code.

Reviewed-by: Jose Javier Rodriguez Barbarin <JoseJavier.Rodriguez@...gon.com>
Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@...gon.com>
---
 drivers/mcb/mcb-pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
index 53d9202ff9a7..3b634ea318c7 100644
--- a/drivers/mcb/mcb-pci.c
+++ b/drivers/mcb/mcb-pci.c
@@ -45,6 +45,14 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 	pci_set_master(pdev);
 
+	flags = pci_resource_flags(pdev, 0);
+	if (flags & IORESOURCE_IO) {
+		ret = -ENOTSUPP;
+		dev_err(&pdev->dev,
+			"IO mapped PCI devices are not supported\n");
+		goto out_disable;
+	}
+
 	priv->mapbase = pci_resource_start(pdev, 0);
 	if (!priv->mapbase) {
 		dev_err(&pdev->dev, "No PCI resource\n");
@@ -68,14 +76,6 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		goto out_disable;
 	}
 
-	flags = pci_resource_flags(pdev, 0);
-	if (flags & IORESOURCE_IO) {
-		ret = -ENOTSUPP;
-		dev_err(&pdev->dev,
-			"IO mapped PCI devices are not supported\n");
-		goto out_disable;
-	}
-
 	pci_set_drvdata(pdev, priv);
 
 	priv->bus = mcb_alloc_bus(&pdev->dev);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ