]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI: fan: cleanup resources in the error path of .probe()
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Wed, 11 Dec 2024 03:28:12 +0000 (12:28 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:49:56 +0000 (12:49 +0100)
commitfc1750250f852f29331d93c97052f7fb612971a5
tree0a0ed6b549ed755755f662e18cd11ffabc9bde0a
parentf575806ef1daff6bbdcd2bf440e1b690f65b4fb3
ACPI: fan: cleanup resources in the error path of .probe()

[ Upstream commit c759bc8e9046f9812238f506d70f07d3ea4206d4 ]

Call thermal_cooling_device_unregister() and sysfs_remove_link() in the
error path of acpi_fan_probe() to fix possible memory leak.

This bug was found by an experimental static analysis tool that I am
developing.

Fixes: 05a83d972293 ("ACPI: register ACPI Fan as generic thermal cooling device")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241211032812.210164-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/fan.c