aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2007-11-17 10:27:01 -0500
committerThomas Gleixner <tglx@apollo.(none)>2007-11-17 10:27:01 -0500
commit3d9befd2cdf65b1768b0d3078a65cc0ae9aa6412 (patch)
tree54d2e8ad6cab03beb2834a4bbe568739b068db79
parent05dfa35e84331c6921ab394463069e9376f0bd76 (diff)
x86: check boundary in count setup resource
need to check info->res_num less than PCI_BUS_NUM_RESOURCES, so info->bus->resource[info->res_num] = res will not beyond of bus resource array when acpi returns too many resource entries. Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Gary Hade <gary.hade@us.ibm.com> Cc: Len Brown <lenb@kernel.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/pci/acpi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 2d88f7c6d6ac..7e35078673a4 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -77,6 +77,9 @@ count_resource(struct acpi_resource *acpi_res, void *data)
77 struct acpi_resource_address64 addr; 77 struct acpi_resource_address64 addr;
78 acpi_status status; 78 acpi_status status;
79 79
80 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
81 return AE_OK;
82
80 status = resource_to_addr(acpi_res, &addr); 83 status = resource_to_addr(acpi_res, &addr);
81 if (ACPI_SUCCESS(status)) 84 if (ACPI_SUCCESS(status))
82 info->res_num++; 85 info->res_num++;
@@ -93,6 +96,9 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
93 unsigned long flags; 96 unsigned long flags;
94 struct resource *root; 97 struct resource *root;
95 98
99 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
100 return AE_OK;
101
96 status = resource_to_addr(acpi_res, &addr); 102 status = resource_to_addr(acpi_res, &addr);
97 if (!ACPI_SUCCESS(status)) 103 if (!ACPI_SUCCESS(status))
98 return AE_OK; 104 return AE_OK;