[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20060717230544.GC5363@us.ibm.com>
Date: Mon, 17 Jul 2006 18:05:44 -0500
From: Jon Mason <jdmason@...ibm.com>
To: ak@...e.de
Cc: muli@...ibm.com, discuss@...-64.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] x86_64: Calgary IOMMU - off by one error
Hey Andi,
Off-by-one error in detect_calgary and calgary_init which will cause
arrays to overflow. Also, removed impossible to hit BUG_ON.
Please consider for inclusion in 2.6.18
Thanks,
Jon
Signed-Off-By: Jon Mason <jdmason@...ibm.com>
Signed-Off-By: Muli Ben-Yehuda <muli@...ibm.com>
diff -r 7815b0fa8a29 -r c59d0a0b1975 arch/x86_64/kernel/pci-calgary.c
--- a/arch/x86_64/kernel/pci-calgary.c Thu Jul 13 09:57:43 2006 +0300
+++ b/arch/x86_64/kernel/pci-calgary.c Thu Jul 13 08:50:58 2006 -0500
@@ -812,7 +812,7 @@ static int __init calgary_init(void)
int i, ret = -ENODEV;
struct pci_dev *dev = NULL;
- for (i = 0; i <= num_online_nodes() * MAX_NUM_OF_PHBS; i++) {
+ for (i = 0; i < num_online_nodes() * MAX_NUM_OF_PHBS; i++) {
dev = pci_get_device(PCI_VENDOR_ID_IBM,
PCI_DEVICE_ID_IBM_CALGARY,
dev);
@@ -890,9 +890,8 @@ void __init detect_calgary(void)
specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE);
for (bus = 0, table_idx = 0;
- bus <= num_online_nodes() * MAX_PHB_BUS_NUM;
+ bus < num_online_nodes() * MAX_PHB_BUS_NUM;
bus++) {
- BUG_ON(bus > MAX_NUMNODES * MAX_PHB_BUS_NUM);
if (read_pci_config(bus, 0, 0, 0) != PCI_VENDOR_DEVICE_ID_CALGARY)
continue;
if (test_bit(bus, translation_disabled)) {
@@ -1002,7 +1001,7 @@ static int __init calgary_parse_options(
if (p == endp)
break;
- if (bridge <= (num_online_nodes() * MAX_PHB_BUS_NUM)) {
+ if (bridge < (num_online_nodes() * MAX_PHB_BUS_NUM)) {
printk(KERN_INFO "Calgary: disabling "
"translation for PHB 0x%x\n", bridge);
set_bit(bridge, translation_disabled);
-
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