diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2021-05-08 10:23:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-19 11:29:52 +0300 |
commit | c5c8f6ffc942cf42f990f22e35bcf4cbe9d8c2fb (patch) | |
tree | 2e6b9a793c729cfad123ee7553f55f3b7da427f9 | |
parent | 0d75b7836a5aa5f4c6d33199677003a54055ced8 (diff) | |
download | linux-c5c8f6ffc942cf42f990f22e35bcf4cbe9d8c2fb.tar.xz |
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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/acpi/scan.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 239eeeafc62f..32a9bd878852 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; } |