提交 fef34861 编写于 作者: M Mattia Dongili 提交者: Matthew Garrett

sony-laptop: fix early NULL pointer dereference

The SNC acpi driver could get early notifications before it fully
initializes and that could lead to dereferencing the sony_nc_handles
structure pointer that is still NULL at that stage.
Make sure we return early from the handle lookup function in these
cases.
Signed-off-by: NMattia Dongili <malattia@linux.it>
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
上级 a0bcaee9
......@@ -808,6 +808,11 @@ static int sony_nc_handles_cleanup(struct platform_device *pd)
static int sony_find_snc_handle(int handle)
{
int i;
/* not initialized yet, return early */
if (!handles)
return -1;
for (i = 0; i < 0x10; i++) {
if (handles->cap[i] == handle) {
dprintk("found handle 0x%.4x (offset: 0x%.2x)\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册