diff mbox

[resend] ACPI/HEST: avoid stack traces when encountering duplicate source IDs

Message ID 4CFE59A50200007800026700@vpn.id2.novell.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jan Beulich Dec. 7, 2010, 2:58 p.m. UTC
None
diff mbox

Patch

--- linux-2.6.37-rc5/drivers/acpi/apei/hest.c
+++ 2.6.37-rc5-acpi-hest-unique/drivers/acpi/apei/hest.c
@@ -139,6 +139,7 @@  static int hest_parse_ghes(struct acpi_h
 {
 	struct platform_device *ghes_dev;
 	struct ghes_arr *ghes_arr = data;
+	unsigned int i;
 	int rc;
 
 	if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
@@ -146,6 +147,16 @@  static int hest_parse_ghes(struct acpi_h
 
 	if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
 		return 0;
+	for (i = 0; i < ghes_arr->count; ++i) {
+		const struct acpi_hest_header *h;
+
+		h = *(void **)dev_get_platdata(&ghes_arr->ghes_devs[i]->dev);
+		if (hest_hdr->source_id == h->source_id) {
+			pr_warn("Duplicate generic error source ID %#x\n",
+				hest_hdr->source_id);
+			return -EEXIST;
+		}
+	}
 	ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
 	if (!ghes_dev)
 		return -ENOMEM;