Patchwork acpica: nspredef: fix null pointer dereference issue (LP: #1195251)

login
register
mail settings
Submitter Colin King
Date June 27, 2013, 10:55 a.m.
Message ID <1372330516-24433-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/255036/
State Accepted
Headers show

Comments

Colin King - June 27, 2013, 10:55 a.m.
From: Colin Ian King <colin.king@canonical.com>

I found that a _WAK that does not return a package trips a null
pointer reference.  Check for a null pointer before the
dereferencing of *ReturnObjectPtr.   This is a hot fix workaround,
we should pick up the official fix in later version of ACPICA.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/source/components/namespace/nspredef.c | 5 +++++
 1 file changed, 5 insertions(+)
Keng-Yu Lin - June 28, 2013, 2:30 a.m.
On Thu, Jun 27, 2013 at 6:55 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> I found that a _WAK that does not return a package trips a null
> pointer reference.  Check for a null pointer before the
> dereferencing of *ReturnObjectPtr.   This is a hot fix workaround,
> we should pick up the official fix in later version of ACPICA.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/components/namespace/nspredef.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/acpica/source/components/namespace/nspredef.c b/src/acpica/source/components/namespace/nspredef.c
> index 941c3bd..e7bc55b 100644
> --- a/src/acpica/source/components/namespace/nspredef.c
> +++ b/src/acpica/source/components/namespace/nspredef.c
> @@ -237,6 +237,11 @@ AcpiNsCheckReturnValue (
>          goto Exit;
>      }
>
> +    if (!(*ReturnObjectPtr))
> +    {
> +        Status = AE_AML_NO_RETURN_VALUE;
> +        goto Exit;
> +    }
>      /*
>       * For returned Package objects, check the type of all sub-objects.
>       * Note: Package may have been newly created by call above.
> --
> 1.8.3.1
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - June 28, 2013, 3:34 a.m.
On 06/27/2013 06:55 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> I found that a _WAK that does not return a package trips a null
> pointer reference.  Check for a null pointer before the
> dereferencing of *ReturnObjectPtr.   This is a hot fix workaround,
> we should pick up the official fix in later version of ACPICA.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/components/namespace/nspredef.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/acpica/source/components/namespace/nspredef.c b/src/acpica/source/components/namespace/nspredef.c
> index 941c3bd..e7bc55b 100644
> --- a/src/acpica/source/components/namespace/nspredef.c
> +++ b/src/acpica/source/components/namespace/nspredef.c
> @@ -237,6 +237,11 @@ AcpiNsCheckReturnValue (
>          goto Exit;
>      }
>  
> +    if (!(*ReturnObjectPtr))
> +    {
> +        Status = AE_AML_NO_RETURN_VALUE;
> +        goto Exit;
> +    }
>      /*
>       * For returned Package objects, check the type of all sub-objects.
>       * Note: Package may have been newly created by call above.
> 
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpica/source/components/namespace/nspredef.c b/src/acpica/source/components/namespace/nspredef.c
index 941c3bd..e7bc55b 100644
--- a/src/acpica/source/components/namespace/nspredef.c
+++ b/src/acpica/source/components/namespace/nspredef.c
@@ -237,6 +237,11 @@  AcpiNsCheckReturnValue (
         goto Exit;
     }
 
+    if (!(*ReturnObjectPtr))
+    {
+        Status = AE_AML_NO_RETURN_VALUE;
+        goto Exit;
+    }
     /*
      * For returned Package objects, check the type of all sub-objects.
      * Note: Package may have been newly created by call above.