diff options
author | Adrian Bunk <bunk@kernel.org> | 2007-10-24 12:26:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-10-25 16:38:02 -0400 |
commit | 1544fdbc857cbe8afca16a521d3254346befeb06 (patch) | |
tree | 6c4111911a0182293ef7a40f90b1196876795625 /drivers/acpi/ec.c | |
parent | c9e4172cde0f793dbf48c99bdfd0abe7d18e4b09 (diff) |
ACPI: EC: fix use-after-free
This patch fixes a use-after-free introduced by
commit 30c08574da0ead1a47797ce028218ce5b2de61c7
(ACPI: EC: Add new query handler to list head)
Spotted by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index bf60b24ebf54..06b78e5e33a1 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -445,9 +445,9 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler); | |||
445 | 445 | ||
446 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | 446 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) |
447 | { | 447 | { |
448 | struct acpi_ec_query_handler *handler; | 448 | struct acpi_ec_query_handler *handler, *tmp; |
449 | mutex_lock(&ec->lock); | 449 | mutex_lock(&ec->lock); |
450 | list_for_each_entry(handler, &ec->list, node) { | 450 | list_for_each_entry_safe(handler, tmp, &ec->list, node) { |
451 | if (query_bit == handler->query_bit) { | 451 | if (query_bit == handler->query_bit) { |
452 | list_del(&handler->node); | 452 | list_del(&handler->node); |
453 | kfree(handler); | 453 | kfree(handler); |