OSDN Git Service

platform/x86: wmi: fix potential null pointer dereference
authorMattias Jacobsson <2pi@mok.nu>
Wed, 30 Jan 2019 15:14:24 +0000 (16:14 +0100)
committerDarren Hart (VMware) <dvhart@infradead.org>
Sat, 23 Feb 2019 17:20:29 +0000 (09:20 -0800)
commitc355ec651a8941864549f2586f969d0eb7bf499a
treef3a1d4abe6ced8d2420383ccdc326dc8148095f8
parentfd47a36fba257b91d4a0bdc2f94fe323e8819c2f
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>
drivers/platform/x86/wmi.c