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: <20080326205828.GA15225@jurassic.park.msu.ru>
Date:	Wed, 26 Mar 2008 23:58:28 +0300
From:	Ivan Kokshaysky <ink@...assic.park.msu.ru>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Gary Hade <garyhade@...ibm.com>, Ingo Molnar <mingo@...e.hu>,
	Thomas Meyer <thomas@...3r.de>,
	Stefan Richter <stefanr@...6.in-berlin.de>,
	Thomas Gleixner <tglx@...utronix.de>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	LKML <linux-kernel@...r.kernel.org>,
	Adrian Bunk <bunk@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Natalie Protasevich <protasnb@...il.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	pm@...ian.org
Subject: Re: [patch] pci: revert "PCI: remove transparent bridge sizing"

On Wed, Mar 26, 2008 at 01:46:33PM -0700, Linus Torvalds wrote:
> Ahh, ok, so it was directly caused by simply not sizing and setting up the 
> bus resources properly.

Indeed.

This should prevent an oops in all cases.

Ivan.

---
PCI: improved sanity check for pdev_sort_resources()

Prevent potential oops with unsized PCI bridge resources.

Signed-off-by: Ivan Kokshaysky <ink@...assic.park.msu.ru>
---
 drivers/pci/setup-res.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 4be7ccf..fb57c8b 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -226,18 +226,17 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
 		if (r->flags & IORESOURCE_PCI_FIXED)
 			continue;
 
-		r_align = r->end - r->start;
-		
+		r_align = (i < PCI_BRIDGE_RESOURCES) ? r->end - r->start + 1 :
+						       r->start;
 		if (!(r->flags) || r->parent)
 			continue;
-		if (!r_align) {
+		if (r_align <= 1) {
 			printk(KERN_WARNING "PCI: Ignore bogus resource %d "
 				"[%llx:%llx] of %s\n",
 				i, (unsigned long long)r->start,
 				(unsigned long long)r->end, pci_name(dev));
 			continue;
 		}
-		r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start;
 		for (list = head; ; list = list->next) {
 			resource_size_t align = 0;
 			struct resource_list *ln = list->next;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ