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>] [day] [month] [year] [list]
Message-ID: <20220901152324.29654-1-jesper.nilsson@axis.com>
Date:   Thu, 1 Sep 2022 17:23:24 +0200
From:   Jesper Nilsson <jesper.nilsson@...s.com>
To:     Bjorn Helgaas <bhelgaas@...gle.com>
CC:     Jesper Nilsson <jesper.nilsson@...s.com>,
        <linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] PCI: Map PCI bios specific error to generic errno

pci_read_config_byte() may return a PCI bios specific error value
(in my case PCIBIOS_DEVICE_NOT_FOUND 0x86) which is nonsensical
to return to the caller of of_irq_parse_pci() which expects
a negative errno if something goes wrong.

Use the appropriate mapping function before passing the error on.

Signed-off-by: Jesper Nilsson <jesper.nilsson@...s.com>
---
 drivers/pci/of.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 196834ed44fe..130bcfe61e04 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -440,8 +440,10 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *
 	 * for PCI. If you do different, then don't use that routine.
 	 */
 	rc = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin);
-	if (rc != 0)
+	if (rc != 0) {
+		rc = pcibios_err_to_errno(rc);
 		goto err;
+	}
 	/* No pin, exit with no error message. */
 	if (pin == 0)
 		return -ENODEV;
-- 
2.36.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ