From: Christophe JAILLET Date: Sat, 8 May 2021 07:23:09 +0000 (+0200) Subject: ACPI: scan: Fix a memory leak in an error handling path X-Git-Tag: v5.10.79~4400 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2381174daeae0ca35eddffef02dcc8de8c1ef8a;p=platform%2Fkernel%2Flinux-rpi.git ACPI: scan: Fix a memory leak in an error handling path [ Upstream commit 0c8bd174f0fc131bc9dfab35cd8784f59045da87 ] If 'acpi_device_set_name()' fails, we must free 'acpi_device_bus_id->bus_id' or there is a (potential) memory leak. Fixes: eb50aaf960e3 ("ACPI: scan: Use unique number for instance_no") Signed-off-by: Christophe JAILLET Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index b47f14a..de0533b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -705,6 +705,7 @@ int acpi_device_add(struct acpi_device *device, result = acpi_device_set_name(device, acpi_device_bus_id); if (result) { + kfree_const(acpi_device_bus_id->bus_id); kfree(acpi_device_bus_id); goto err_unlock; }