]> Gentwo Git Trees - linux/.git/commit
ACPI: MRRM: Fix memory leaks and improve error handling
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Thu, 30 Oct 2025 02:32:28 +0000 (08:02 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 7 Nov 2025 20:48:49 +0000 (21:48 +0100)
commit4b93d211bbffd3dce76664d95f2306d23e7215ce
tree1fec793e6d6d1106604671baf41121a8370bc458
parent6146a0f1dfae5d37442a9ddcba012add260bceb0
ACPI: MRRM: Fix memory leaks and improve error handling

Add proper error handling and resource cleanup to prevent memory leaks
in add_boot_memory_ranges(). The function now checks for NULL return
from kobject_create_and_add(), uses local buffer for range names to
avoid dynamic allocation, and implements a cleanup path that removes
previously created sysfs groups and kobjects on failure.

This prevents resource leaks when kobject creation or sysfs group
creation fails during boot memory range initialization.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://patch.msgid.link/20251030023228.3956296-1-kaushlendra.kumar@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_mrrm.c