提交 c355ec65 编写于 作者: M Mattias Jacobsson 提交者: Darren Hart (VMware)

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: 844af950 ("platform/x86: wmi: Turn WMI into a bus driver")
Signed-off-by: NMattias Jacobsson <2pi@mok.nu>
Signed-off-by: NDarren Hart (VMware) <dvhart@infradead.org>
上级 fd47a36f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册