mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects
[ Upstream commit 883cf0d4cf ]
If a badly constructed firmware includes multiple `ACPI_TYPE_PACKAGE`
objects while evaluating the AMD LPS0 _DSM, there will be a memory
leak. Explicitly guard against this.
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
eda268b5b7
commit
7b7964cd9d
@@ -111,6 +111,12 @@ static void lpi_device_get_constraints_amd(void)
|
|||||||
union acpi_object *package = &out_obj->package.elements[i];
|
union acpi_object *package = &out_obj->package.elements[i];
|
||||||
|
|
||||||
if (package->type == ACPI_TYPE_PACKAGE) {
|
if (package->type == ACPI_TYPE_PACKAGE) {
|
||||||
|
if (lpi_constraints_table) {
|
||||||
|
acpi_handle_err(lps0_device_handle,
|
||||||
|
"Duplicate constraints list\n");
|
||||||
|
goto free_acpi_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
lpi_constraints_table = kcalloc(package->package.count,
|
lpi_constraints_table = kcalloc(package->package.count,
|
||||||
sizeof(*lpi_constraints_table),
|
sizeof(*lpi_constraints_table),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user