public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] acpi/ec.c: fix use-after-free
@ 2007-10-24 16:26 Adrian Bunk
  2007-10-24 17:15 ` Alexey Starikovskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2007-10-24 16:26 UTC (permalink / raw)
  To: Alexey Starikovskiy, Len Brown; +Cc: linux-acpi, linux-kernel

This patch fixes a use-after-free introduced by
commit 30c08574da0ead1a47797ce028218ce5b2de61c7.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
--- linux-2.6/drivers/acpi/ec.c.old	2007-10-23 19:39:47.000000000 +0200
+++ linux-2.6/drivers/acpi/ec.c	2007-10-23 19:34:55.000000000 +0200
@@ -434,11 +442,11 @@
 EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
 
 void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
 {
-	struct acpi_ec_query_handler *handler;
+	struct acpi_ec_query_handler *handler, *tmp;
 	mutex_lock(&ec->lock);
-	list_for_each_entry(handler, &ec->list, node) {
+	list_for_each_entry_safe(handler, tmp, &ec->list, node) {
 		if (query_bit == handler->query_bit) {
 			list_del(&handler->node);
 			kfree(handler);
 		}


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

end of thread, other threads:[~2007-10-25 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 16:26 [2.6 patch] acpi/ec.c: fix use-after-free Adrian Bunk
2007-10-24 17:15 ` Alexey Starikovskiy
2007-10-24 17:26   ` Adrian Bunk
2007-10-24 17:30     ` Alexey Starikovskiy
2007-10-25 20:38       ` Len Brown

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