[PATCH 1/1] UBUNTU: SAUCE: ACPI / bus: Fix NULL pointer dereference in acpi_quirk_matches_bios_ids()

Kai-Heng Feng kai.heng.feng at canonical.com
Tue Jul 9 11:11:34 UTC 2019


BugLink: https://bugs.launchpad.net/bugs/1829378

Bail out early when either bios_vendor or bios_ver is NULL.

Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
 drivers/acpi/bus.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 0b306a7cef77..159c79756bb4 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -121,7 +121,10 @@ bool acpi_quirk_matches_bios_ids(const char * const ids[])
 	const char *bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
 	int i;
 
-	if ((!bios_vendor) && (!bios_ver) && strncmp(bios_vendor, "LENOVO", 6))
+	if (!bios_vendor || !bios_ver)
+		return false;
+
+	if (strncmp(bios_vendor, "LENOVO", 6))
 		return false;
 
 	for (i = 0; ids[i]; i++)
-- 
2.17.1




More information about the kernel-team mailing list