aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorMattias Jacobsson <2pi@mok.nu>2019-01-30 16:14:24 +0100
committerDarren Hart (VMware) <dvhart@infradead.org>2019-02-23 09:20:29 -0800
commitc355ec651a8941864549f2586f969d0eb7bf499a (patch)
treef3a1d4abe6ced8d2420383ccdc326dc8148095f8 /drivers/platform
parentplatform/x86: dell_rbu: stop abusing the DMA API (diff)
downloadlinux-dev-c355ec651a8941864549f2586f969d0eb7bf499a.tar.xz
linux-dev-c355ec651a8941864549f2586f969d0eb7bf499a.zip
platform/x86: wmi: fix potential null pointer dereference
In the function wmi_dev_match() the variable id is dereferenced without first performing a NULL check. The variable can for example be NULL if a WMI driver is registered without specifying the id_table field in struct wmi_driver. Add a NULL check and return that the driver can't handle the device if the variable is NULL. Fixes: 844af950da94 ("platform/x86: wmi: Turn WMI into a bus driver") Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/wmi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index bea35be68706..b0f3d8ecd898 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -768,6 +768,9 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver)
struct wmi_block *wblock = dev_to_wblock(dev);
const struct wmi_device_id *id = wmi_driver->id_table;
+ if (id == NULL)
+ return 0;
+
while (id->guid_string) {
uuid_le driver_guid;