From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AC651DE3B8; Wed, 6 Nov 2024 12:14:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730895241; cv=none; b=LBsJKh3fwXJbAQJAHnIcFkd5AEygUjlF6OnDxvzokI2o4sQ5hB51ZG/WHAJOwHE8EHfUgQPOrwGpaPadSXw3c/SrkznPjwwjuWy52KdSlaTtaO2RDOl3hpgt6LHXkyrsI7qLU5HG8FTFUyGsPFb/RLuFjqXV+hSBNjFQ2ZzSfCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730895241; c=relaxed/simple; bh=haVM7gE6hFW7maec84DP3NGOp3wSeEhsZleGgP5BBxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t70tA0yYZbEP2lwT/SF4+ZoWSljzO8/ils0un9VHYgsrmzWuLVfn7Rz5pcJ/yAnkIxGsr4sYbvq+cz8Mu76v7Az7Nf+MQpj//FLVTfqyjJAJodfH+uP3j4zNNxp7fczcn8hjeG7kG4e4vDhqltYe66k2ZRmI6GZh6dpZZJUxLMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=n5abZYgl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="n5abZYgl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B72C4CECD; Wed, 6 Nov 2024 12:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730895240; bh=haVM7gE6hFW7maec84DP3NGOp3wSeEhsZleGgP5BBxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5abZYglFhi0CJDTy8uK6KkgJi71E47Hz+gRxb1tVHNyi8cDc/gix1ztAc3MqW5/9 03r8sqkZzl8Dipt4dGnukl+tTPfS9bc/EKYb4nxdMDMCI4lJMJ6YzTBg6UbzIwNsku MoFEmDq3Fd0bupo5LKYVulnKWq6BjmLypPKdQXJM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Armin Wolf , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 151/350] ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails Date: Wed, 6 Nov 2024 13:01:19 +0100 Message-ID: <20241106120324.646474463@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120320.865793091@linuxfoundation.org> References: <20241106120320.865793091@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Armin Wolf [ Upstream commit 5accb265f7a1b23e52b0ec42313d1e12895552f4 ] ACPICA commit 2802af722bbde7bf1a7ac68df68e179e2555d361 If acpi_ps_get_next_namepath() fails, the previously allocated union acpi_parse_object needs to be freed before returning the status code. The issue was first being reported on the Linux ACPI mailing list: Link: https://lore.kernel.org/linux-acpi/56f94776-484f-48c0-8855-dba8e6a7793b@yandex.ru/T/ Link: https://github.com/acpica/acpica/commit/2802af72 Signed-off-by: Armin Wolf Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpica/psargs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 176d28d60125d..576ac74a47935 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c @@ -820,6 +820,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, acpi_ps_get_next_namepath(walk_state, parser_state, arg, ACPI_NOT_METHOD_CALL); + if (ACPI_FAILURE(status)) { + acpi_ps_free_op(arg); + return_ACPI_STATUS(status); + } } else { /* Single complex argument, nothing returned */ @@ -854,6 +858,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, acpi_ps_get_next_namepath(walk_state, parser_state, arg, ACPI_POSSIBLE_METHOD_CALL); + if (ACPI_FAILURE(status)) { + acpi_ps_free_op(arg); + return_ACPI_STATUS(status); + } if (arg->common.aml_opcode == AML_INT_METHODCALL_OP) { -- 2.43.0