Commit 3062a987 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ACPI fix from Rafael Wysocki:
 "Fix the acpi_thermal_add() error path that may do a double-free in
  some cases after recent changes (Dan Carpenter)"

* tag 'acpi-6.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: thermal: Fix acpi_thermal_unregister_thermal_zone() cleanup
parents 90b0c2b2 4b27d5c4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -702,9 +702,9 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,

static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
{
	thermal_zone_device_disable(tz->thermal_zone);
	acpi_thermal_zone_sysfs_remove(tz);
	thermal_zone_device_unregister(tz->thermal_zone);
	kfree(tz->trip_table);
	tz->thermal_zone = NULL;
}

@@ -967,7 +967,7 @@ static void acpi_thermal_remove(struct acpi_device *device)

	flush_workqueue(acpi_thermal_pm_queue);
	acpi_thermal_unregister_thermal_zone(tz);

	kfree(tz->trip_table);
	acpi_thermal_free_thermal_zone(tz);
}