Skip to content

Commit c355ec6

Browse files
2pidvhart
authored andcommitted
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: 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]>
1 parent fd47a36 commit c355ec6

File tree

1 file changed

+3
-0
lines changed
  • drivers/platform/x86

1 file changed

+3
-0
lines changed

drivers/platform/x86/wmi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,9 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver)
768768
struct wmi_block *wblock = dev_to_wblock(dev);
769769
const struct wmi_device_id *id = wmi_driver->id_table;
770770

771+
if (id == NULL)
772+
return 0;
773+
771774
while (id->guid_string) {
772775
uuid_le driver_guid;
773776

0 commit comments

Comments
 (0)