Skip to content

Commit

Permalink
sony-laptop: fix early NULL pointer dereference
Browse files Browse the repository at this point in the history
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: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Mattia Dongili authored and Matthew Garrett committed Apr 4, 2011
1 parent a0bcaee commit fef3486
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit fef3486

Please sign in to comment.