lkml.org 
[lkml]   [2008]   [Mar]   [26]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
Patch in this message
/
DateWed, 26 Mar 2008 23:58:28 +0300
FromIvan Kokshaysky <>
SubjectRe: [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@jurassic.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2008-03-26 21:01    [W:0.450 / U:0.040 seconds]
©2003-2008 Jasper Spaans