From e8f8dbdb390ea112fa13a0d369a4bcfc34174cde Mon Sep 17 00:00:00 2001 From: allanjude Date: Sat, 13 Jun 2015 05:55:26 +0000 Subject: acpi_ibm.ko panics if SMBIOS information is not available Add a check for NULL before strcmp on smbios information incase it is not populated Differential Revision: https://reviews.freebsd.org/D2750 Reviewed by: ngie, jhb Approved by: rpaulo Sponsored by: ScaleEngine Inc. --- sys/dev/acpi_support/acpi_ibm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/dev/acpi_support/acpi_ibm.c') diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 1163681..f8ff1eb 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -485,6 +485,9 @@ acpi_ibm_attach(device_t dev) /* Enable per-model events. */ maker = kern_getenv("smbios.system.maker"); product = kern_getenv("smbios.system.product"); + if (maker != NULL && product != NULL) + goto nosmbios; + for (i = 0; i < nitems(acpi_ibm_models); i++) { if (strcmp(maker, acpi_ibm_models[i].maker) == 0 && strcmp(product, acpi_ibm_models[i].product) == 0) { @@ -494,6 +497,8 @@ acpi_ibm_attach(device_t dev) ACPI_SERIAL_END(ibm); } } + +nosmbios: freeenv(maker); freeenv(product); -- cgit v1.1 From 3aad3304b32eadced83462492cc3d3c70527bc72 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 13 Jun 2015 22:27:59 +0000 Subject: Fix inverted check by skipping over the model-specific checks if the maker or product is NULL, not if they are both not NULL Reported by: araujo, kib X-MFC with: r283678, r284336 Pointyhat to: allanjude --- sys/dev/acpi_support/acpi_ibm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/acpi_support/acpi_ibm.c') diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index f8ff1eb..77509af 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -485,7 +485,7 @@ acpi_ibm_attach(device_t dev) /* Enable per-model events. */ maker = kern_getenv("smbios.system.maker"); product = kern_getenv("smbios.system.product"); - if (maker != NULL && product != NULL) + if (maker == NULL && product == NULL) goto nosmbios; for (i = 0; i < nitems(acpi_ibm_models); i++) { -- cgit v1.1 From 80afc77e639e2939d012ad431e45c254cbb0d9d4 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 13 Jun 2015 22:29:43 +0000 Subject: Fix previous commit (r284357) I forgot to convert the && to a || Pointyhat to: ngie X-MFC with: r283678, r284336, r284357 --- sys/dev/acpi_support/acpi_ibm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/acpi_support/acpi_ibm.c') diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 77509af..735065a 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -485,7 +485,7 @@ acpi_ibm_attach(device_t dev) /* Enable per-model events. */ maker = kern_getenv("smbios.system.maker"); product = kern_getenv("smbios.system.product"); - if (maker == NULL && product == NULL) + if (maker == NULL || product == NULL) goto nosmbios; for (i = 0; i < nitems(acpi_ibm_models); i++) { -- cgit v1.1