Re: [patch] pci: revert "PCI: remove transparent bridge sizing"
From: Ivan Kokshaysky
Date: Wed Mar 26 2008 - 16:58:45 EST
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@xxxxxxxxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/