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 BF8AE19B3FF; Tue, 15 Oct 2024 11:57:53 +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=1728993473; cv=none; b=WTfYmw4GsiR5256qbBlWhpwBt/dXR65uvxsco0d5ltwYFJFpaBZhAbFkEP2SaNHtZSmVjtmp+LeSk2/2ufAGMf4ksphLhZfwNwxL6hKFSrAl/bHe60u111MZhS0Qhe6QciTcO4yBSMyD0ubS0CKSXah4CxqtimuKb3BDW+GP8NM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993473; c=relaxed/simple; bh=eXO+CtBoyB0aPGvywgEzdX8zL9mkw3EwKrxngmuW3IE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adohD455r1VNFypyftDSbCLrXEo6KYPlAhjPbar8A+ZLvPzh3HkKxEwoJWWIUirh6Zb+VU+uYgV3z7RZK8Ov6tsLUYP2ACLWJcNtUAU2yc6geITKTgAlTzrG1NAJShaX/8E5Js32IGTr2vRA6Mu98wSpbCkuU/xTCHfwpq6NSOg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=to5GjOdM; 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="to5GjOdM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30AE1C4CEC6; Tue, 15 Oct 2024 11:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728993473; bh=eXO+CtBoyB0aPGvywgEzdX8zL9mkw3EwKrxngmuW3IE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=to5GjOdMSmvVtA8BE0zkp+BykmsTTHNeb+cZbMjfoqb1YLMqHcpxutgUQItEvYJsx LBTGFV51YT0foAX++fkTPcAebPRWWtIkRl7gXT744rJ858u9HehyYU0pEYUqTFjImu ZVpfMTDPMdYgPm62ejoxvstNlsYeLjczBSNhvFDc= 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 5.15 415/691] ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails Date: Tue, 15 Oct 2024 13:26:03 +0200 Message-ID: <20241015112456.814369961@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@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 5.15-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 b9ff535aa02e6..fd351074c6129 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