]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
platform/x86: wmi: fix potential null pointer dereference
authorMattias Jacobsson <2pi@mok.nu>
Wed, 30 Jan 2019 15:14:24 +0000 (16:14 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commit9a431ef056c769a53a3e8c144983e4779634487d
tree88ba882a1bcaa5b5c05c890514b5dbfc0d908c7b
parent4670162de77854c149bc77cf08dcc428851d1a0b
platform/x86: wmi: fix potential null pointer dereference

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit c355ec651a8941864549f2586f969d0eb7bf499a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/platform/x86/wmi.c