Skip to content

Commit

Permalink
ACPI: EC: fix use-after-free
Browse files Browse the repository at this point in the history
This patch fixes a use-after-free introduced by
commit 30c0857
(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>
  • Loading branch information
Adrian Bunk authored and Len Brown committed Oct 25, 2007
1 parent c9e4172 commit 1544fdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ 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);
Expand Down

0 comments on commit 1544fdb

Please sign in to comment.