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: <20210421184747.62391-1-ameynarkhede03@gmail.com>
Date:   Thu, 22 Apr 2021 00:17:47 +0530
From:   Amey Narkhede <ameynarkhede03@...il.com>
To:     Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        Amey Narkhede <ameynarkhede03@...il.com>
Subject: [PATCH] PCI: Check value of resource alignment before using __ffs

Return value of __ffs is undefined if no set bit exists in
its argument. This indicates that the associated BAR has
invalid alignment.

Signed-off-by: Amey Narkhede <ameynarkhede03@...il.com>
---
 drivers/pci/setup-bus.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 2ce636937c6e..44e8449418ae 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1044,6 +1044,11 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 			 * resources.
 			 */
 			align = pci_resource_alignment(dev, r);
+			if (!align) {
+				pci_warn(dev, "BAR %d: %pR has bogus alignment\n",
+					 i, r);
+				continue;
+			}
 			order = __ffs(align) - 20;
 			if (order < 0)
 				order = 0;
--
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ