Skip to content

Commit

Permalink
ACPI: EC: acpi_ec_remove(): fix use-after-free
Browse files Browse the repository at this point in the history
This patch fixes an obvious use-after-free introduced by
commit 837012e.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Adrian Bunk authored and Len Brown committed Aug 4, 2007
1 parent 7c010de commit 07ddf76
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
@@ -730,14 +730,14 @@ static int acpi_ec_add(struct acpi_device *device)
static int acpi_ec_remove(struct acpi_device *device, int type)
{
struct acpi_ec *ec;
struct acpi_ec_query_handler *handler;
struct acpi_ec_query_handler *handler, *tmp;

if (!device)
return -EINVAL;

ec = acpi_driver_data(device);
mutex_lock(&ec->lock);
list_for_each_entry(handler, &ec->list, node) {
list_for_each_entry_safe(handler, tmp, &ec->list, node) {
list_del(&handler->node);
kfree(handler);
}

0 comments on commit 07ddf76

Please sign in to comment.