Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
platform/x86: wmi: fix potential null pointer dereference
Browse files Browse the repository at this point in the history
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: 844af95 ("platform/x86: wmi: Turn WMI into a bus driver")
Signed-off-by: Mattias Jacobsson <[email protected]>
Signed-off-by: Darren Hart (VMware) <[email protected]>
  • Loading branch information
2pi authored and dvhart committed Feb 23, 2019
1 parent fd47a36 commit c355ec6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/platform/x86/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c355ec6

Please sign in to comment.