Linux ACPI
 help / color / mirror / Atom feed
* [patch] prevent possible NULL dereference. (fwd)
@ 2009-12-09 19:34 Len Brown
  2009-12-09 19:54 ` [Devel] " Moore, Robert
  2009-12-10 22:50 ` Moore, Robert
  0 siblings, 2 replies; 4+ messages in thread
From: Len Brown @ 2009-12-09 19:34 UTC (permalink / raw)
  To: devel; +Cc: linux-acpi, Dan Carpenter

forwarded to devel@acpica.org

thanks,
Len Brown, Intel Open Source Technology Center

---------- Forwarded message ----------
Date: Tue, 10 Nov 2009 11:02:49 +0200 (SAST)
From: Dan Carpenter <error27@gmail.com>
To: linux-acpi@vger.kernel.org
Cc: lenb@kernel.org
Subject: [patch] prevent possible NULL dereference.

Move the check for walk_state->thread before the dereference.

Found by smatch static checker.  Compile tested.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/drivers/acpi/acpica/exmutex.c	2009-11-07 09:46:53.000000000 +0200
+++ devel/drivers/acpi/acpica/exmutex.c	2009-11-07 09:48:16.000000000 +0200
@@ -375,6 +375,15 @@
 		return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
 	}
 
+	/* Must have a valid thread ID */
+
+	if (!walk_state->thread) {
+		ACPI_ERROR((AE_INFO,
+			    "Cannot release Mutex [%4.4s], null thread info",
+			    acpi_ut_get_node_name(obj_desc->mutex.node)));
+		return_ACPI_STATUS(AE_AML_INTERNAL);
+	}
+
 	/*
 	 * The Mutex is owned, but this thread must be the owner.
 	 * Special case for Global Lock, any thread can release
@@ -392,15 +401,6 @@
 		return_ACPI_STATUS(AE_AML_NOT_OWNER);
 	}
 
-	/* Must have a valid thread ID */
-
-	if (!walk_state->thread) {
-		ACPI_ERROR((AE_INFO,
-			    "Cannot release Mutex [%4.4s], null thread info",
-			    acpi_ut_get_node_name(obj_desc->mutex.node)));
-		return_ACPI_STATUS(AE_AML_INTERNAL);
-	}
-
 	/*
 	 * The sync level of the mutex must be equal to the current sync level. In
 	 * other words, the current level means that at least one mutex at that
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Devel] [patch] prevent possible NULL dereference. (fwd)
  2009-12-09 19:34 [patch] prevent possible NULL dereference. (fwd) Len Brown
@ 2009-12-09 19:54 ` Moore, Robert
  2009-12-09 20:36   ` Len Brown
  2009-12-10 22:50 ` Moore, Robert
  1 sibling, 1 reply; 4+ messages in thread
From: Moore, Robert @ 2009-12-09 19:54 UTC (permalink / raw)
  To: Len Brown, devel@acpica.org; +Cc: linux-acpi@vger.kernel.org, Dan Carpenter

Was this in response to a specific problem seen in the field?
Bob


>-----Original Message-----
>From: devel-bounces@acpica.org [mailto:devel-bounces@acpica.org] On Behalf
>Of Len Brown
>Sent: Wednesday, December 09, 2009 11:35 AM
>To: devel@acpica.org
>Cc: linux-acpi@vger.kernel.org; Dan Carpenter
>Subject: [Devel] [patch] prevent possible NULL dereference. (fwd)
>
>forwarded to devel@acpica.org
>
>thanks,
>Len Brown, Intel Open Source Technology Center
>
>---------- Forwarded message ----------
>Date: Tue, 10 Nov 2009 11:02:49 +0200 (SAST)
>From: Dan Carpenter <error27@gmail.com>
>To: linux-acpi@vger.kernel.org
>Cc: lenb@kernel.org
>Subject: [patch] prevent possible NULL dereference.
>
>Move the check for walk_state->thread before the dereference.
>
>Found by smatch static checker.  Compile tested.
>
>regards,
>dan carpenter
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>
>--- orig/drivers/acpi/acpica/exmutex.c	2009-11-07 09:46:53.000000000
>+0200
>+++ devel/drivers/acpi/acpica/exmutex.c	2009-11-07 09:48:16.000000000
>+0200
>@@ -375,6 +375,15 @@
> 		return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
> 	}
>
>+	/* Must have a valid thread ID */
>+
>+	if (!walk_state->thread) {
>+		ACPI_ERROR((AE_INFO,
>+			    "Cannot release Mutex [%4.4s], null thread info",
>+			    acpi_ut_get_node_name(obj_desc->mutex.node)));
>+		return_ACPI_STATUS(AE_AML_INTERNAL);
>+	}
>+
> 	/*
> 	 * The Mutex is owned, but this thread must be the owner.
> 	 * Special case for Global Lock, any thread can release
>@@ -392,15 +401,6 @@
> 		return_ACPI_STATUS(AE_AML_NOT_OWNER);
> 	}
>
>-	/* Must have a valid thread ID */
>-
>-	if (!walk_state->thread) {
>-		ACPI_ERROR((AE_INFO,
>-			    "Cannot release Mutex [%4.4s], null thread info",
>-			    acpi_ut_get_node_name(obj_desc->mutex.node)));
>-		return_ACPI_STATUS(AE_AML_INTERNAL);
>-	}
>-
> 	/*
> 	 * The sync level of the mutex must be equal to the current sync
>level. In
> 	 * other words, the current level means that at least one mutex at
>that
>--
>To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>_______________________________________________
>Devel mailing list
>Devel@acpica.org
>http://lists.acpica.org/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Devel] [patch] prevent possible NULL dereference. (fwd)
  2009-12-09 19:54 ` [Devel] " Moore, Robert
@ 2009-12-09 20:36   ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2009-12-09 20:36 UTC (permalink / raw)
  To: Moore, Robert; +Cc: devel@acpica.org, linux-acpi@vger.kernel.org, Dan Carpenter

> Was this in response to a specific problem seen in the field?

I don't think so, the submitter refers to a static code checker --
simply identifying a use before test.

-Len

> 
> >-----Original Message-----
> >From: devel-bounces@acpica.org [mailto:devel-bounces@acpica.org] On Behalf
> >Of Len Brown
> >Sent: Wednesday, December 09, 2009 11:35 AM
> >To: devel@acpica.org
> >Cc: linux-acpi@vger.kernel.org; Dan Carpenter
> >Subject: [Devel] [patch] prevent possible NULL dereference. (fwd)
> >
> >forwarded to devel@acpica.org
> >
> >thanks,
> >Len Brown, Intel Open Source Technology Center
> >
> >---------- Forwarded message ----------
> >Date: Tue, 10 Nov 2009 11:02:49 +0200 (SAST)
> >From: Dan Carpenter <error27@gmail.com>
> >To: linux-acpi@vger.kernel.org
> >Cc: lenb@kernel.org
> >Subject: [patch] prevent possible NULL dereference.
> >
> >Move the check for walk_state->thread before the dereference.
> >
> >Found by smatch static checker.  Compile tested.
> >
> >regards,
> >dan carpenter
> >
> >Signed-off-by: Dan Carpenter <error27@gmail.com>
> >
> >--- orig/drivers/acpi/acpica/exmutex.c	2009-11-07 09:46:53.000000000
> >+0200
> >+++ devel/drivers/acpi/acpica/exmutex.c	2009-11-07 09:48:16.000000000
> >+0200
> >@@ -375,6 +375,15 @@
> > 		return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
> > 	}
> >
> >+	/* Must have a valid thread ID */
> >+
> >+	if (!walk_state->thread) {
> >+		ACPI_ERROR((AE_INFO,
> >+			    "Cannot release Mutex [%4.4s], null thread info",
> >+			    acpi_ut_get_node_name(obj_desc->mutex.node)));
> >+		return_ACPI_STATUS(AE_AML_INTERNAL);
> >+	}
> >+
> > 	/*
> > 	 * The Mutex is owned, but this thread must be the owner.
> > 	 * Special case for Global Lock, any thread can release
> >@@ -392,15 +401,6 @@
> > 		return_ACPI_STATUS(AE_AML_NOT_OWNER);
> > 	}
> >
> >-	/* Must have a valid thread ID */
> >-
> >-	if (!walk_state->thread) {
> >-		ACPI_ERROR((AE_INFO,
> >-			    "Cannot release Mutex [%4.4s], null thread info",
> >-			    acpi_ut_get_node_name(obj_desc->mutex.node)));
> >-		return_ACPI_STATUS(AE_AML_INTERNAL);
> >-	}
> >-
> > 	/*
> > 	 * The sync level of the mutex must be equal to the current sync
> >level. In
> > 	 * other words, the current level means that at least one mutex at
> >that
> >--
> >To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >_______________________________________________
> >Devel mailing list
> >Devel@acpica.org
> >http://lists.acpica.org/listinfo/devel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Devel] [patch] prevent possible NULL dereference. (fwd)
  2009-12-09 19:34 [patch] prevent possible NULL dereference. (fwd) Len Brown
  2009-12-09 19:54 ` [Devel] " Moore, Robert
@ 2009-12-10 22:50 ` Moore, Robert
  1 sibling, 0 replies; 4+ messages in thread
From: Moore, Robert @ 2009-12-10 22:50 UTC (permalink / raw)
  To: Len Brown, devel@acpica.org; +Cc: linux-acpi@vger.kernel.org, Dan Carpenter

Added to ACPICA base code for the next release (mid-December).

Thanks,
Bob


>-----Original Message-----
>From: devel-bounces@acpica.org [mailto:devel-bounces@acpica.org] On Behalf
>Of Len Brown
>Sent: Wednesday, December 09, 2009 11:35 AM
>To: devel@acpica.org
>Cc: linux-acpi@vger.kernel.org; Dan Carpenter
>Subject: [Devel] [patch] prevent possible NULL dereference. (fwd)
>
>forwarded to devel@acpica.org
>
>thanks,
>Len Brown, Intel Open Source Technology Center
>
>---------- Forwarded message ----------
>Date: Tue, 10 Nov 2009 11:02:49 +0200 (SAST)
>From: Dan Carpenter <error27@gmail.com>
>To: linux-acpi@vger.kernel.org
>Cc: lenb@kernel.org
>Subject: [patch] prevent possible NULL dereference.
>
>Move the check for walk_state->thread before the dereference.
>
>Found by smatch static checker.  Compile tested.
>
>regards,
>dan carpenter
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>
>--- orig/drivers/acpi/acpica/exmutex.c	2009-11-07 09:46:53.000000000
>+0200
>+++ devel/drivers/acpi/acpica/exmutex.c	2009-11-07 09:48:16.000000000
>+0200
>@@ -375,6 +375,15 @@
> 		return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
> 	}
>
>+	/* Must have a valid thread ID */
>+
>+	if (!walk_state->thread) {
>+		ACPI_ERROR((AE_INFO,
>+			    "Cannot release Mutex [%4.4s], null thread info",
>+			    acpi_ut_get_node_name(obj_desc->mutex.node)));
>+		return_ACPI_STATUS(AE_AML_INTERNAL);
>+	}
>+
> 	/*
> 	 * The Mutex is owned, but this thread must be the owner.
> 	 * Special case for Global Lock, any thread can release
>@@ -392,15 +401,6 @@
> 		return_ACPI_STATUS(AE_AML_NOT_OWNER);
> 	}
>
>-	/* Must have a valid thread ID */
>-
>-	if (!walk_state->thread) {
>-		ACPI_ERROR((AE_INFO,
>-			    "Cannot release Mutex [%4.4s], null thread info",
>-			    acpi_ut_get_node_name(obj_desc->mutex.node)));
>-		return_ACPI_STATUS(AE_AML_INTERNAL);
>-	}
>-
> 	/*
> 	 * The sync level of the mutex must be equal to the current sync
>level. In
> 	 * other words, the current level means that at least one mutex at
>that
>--
>To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>_______________________________________________
>Devel mailing list
>Devel@acpica.org
>http://lists.acpica.org/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-10 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 19:34 [patch] prevent possible NULL dereference. (fwd) Len Brown
2009-12-09 19:54 ` [Devel] " Moore, Robert
2009-12-09 20:36   ` Len Brown
2009-12-10 22:50 ` Moore, Robert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox