Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07ddf768 authored by Adrian Bunk's avatar Adrian Bunk Committed by Len Brown
Browse files

ACPI: EC: acpi_ec_remove(): fix use-after-free



This patch fixes an obvious use-after-free introduced by
commit 837012ed.

Spotted by the Coverity checker.

Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Acked-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 7c010de7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
	}