aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-i801.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-06-13 19:45:27 +0300
committerWolfram Sang <wsa@the-dreams.de>2019-06-14 23:24:33 +0200
commitaa5ae06515a451d543d9ab37e2c14f97a5ba4519 (patch)
tree12eab9f4de7768d15a8ba18219bdb7bfb8a2749f /drivers/i2c/busses/i2c-i801.c
parentfdb7e884ad617f8aa69abdd7f39e3fdac85e081e (diff)
downloadlinux-aa5ae06515a451d543d9ab37e2c14f97a5ba4519.tar.gz
i2c: i801: Fix kernel crash in is_dell_system_with_lis3lv02d()
The commit 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines") introduced a new check in order to enumerate some slave devices on Dell machines. Though, it brings a regression on machines where DMI vendor is not set. BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 8 PID: 1 Comm: swapper/0 Not tainted 5.2.0-rc4-next-20190613+ #317 RIP: 0010:strcmp+0xc/0x20 To fix this crash, check if vendor field is present before accessing to it. Fixes: 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-i801.c')
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index c5bdaf35cd09d1..7d14b6729772a0 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1188,7 +1188,7 @@ static bool is_dell_system_with_lis3lv02d(void)
const char *vendor;
vendor = dmi_get_system_info(DMI_SYS_VENDOR);
- if (strcmp(vendor, "Dell Inc.") != 0)
+ if (!vendor || strcmp(vendor, "Dell Inc."))
return false;
/*