Skip to content
Snippets Groups Projects
Commit c5c8f6ff authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

ACPI: scan: Fix a memory leak in an error handling path


[ Upstream commit 0c8bd174 ]

If 'acpi_device_set_name()' fails, we must free
'acpi_device_bus_id->bus_id' or there is a (potential) memory leak.

Fixes: eb50aaf9 ("ACPI: scan: Use unique number for instance_no")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0d75b783
No related branches found
No related tags found
No related merge requests found
...@@ -705,6 +705,7 @@ int acpi_device_add(struct acpi_device *device, ...@@ -705,6 +705,7 @@ int acpi_device_add(struct acpi_device *device,
result = acpi_device_set_name(device, acpi_device_bus_id); result = acpi_device_set_name(device, acpi_device_bus_id);
if (result) { if (result) {
kfree_const(acpi_device_bus_id->bus_id);
kfree(acpi_device_bus_id); kfree(acpi_device_bus_id);
goto err_unlock; goto err_unlock;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment