diff options
author | Mattia Dongili <malattia@linux.it> | 2011-04-02 19:00:44 +0900 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-04-04 12:51:13 -0400 |
commit | fef34861381eefe266c822fc28bdedc897a8265f (patch) | |
tree | 01baebe9b5d24d33805553ad7d3d39996495e30e | |
parent | a0bcaee99df69b6d4d4dfd30bd40ac24b5ad3e22 (diff) | |
download | linux-fef34861381eefe266c822fc28bdedc897a8265f.tar.gz linux-fef34861381eefe266c822fc28bdedc897a8265f.tar.bz2 linux-fef34861381eefe266c822fc28bdedc897a8265f.zip |
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: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e642f5f29504..33c3b8c066ee 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -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", |