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 7E7701DF75D; Tue, 8 Oct 2024 13:12:39 +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=1728393159; cv=none; b=AhPBpjnLCQiV6XFff0E+/6bl/GukBB2GSqQ/+Ps/CfQTF82y0U9HcsXOU7pHIkUOuzNC7hfCTkKByOABGHhw+4ZuG9oGqr/1qw6xBzYbgRRQbOzUsCMWbXxLFA5A/6e/yAQaHf50XpD316uzcFzpCf/ox0sllc+UzUPLUCUPjfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728393159; c=relaxed/simple; bh=1py/cpOwOB32tH1uJZ9jqE916YjdBh98DHYdJSxGhS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JtOdeM6OGIPDpmzYT2gBMbrnINwBrJWg0lbvxfFbN5ay1+e65xTf55bl7H2g4WbTgy6lar/ITsGMpy3ELwBgsy+lZKxHgZw+4VArS8sISxIahHxoajw3aFbJ9w2oMbVXX11lA564snHTibzUObbOHnLCGkuLjPOYdISEmdRM7b0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=smmC1B8Q; 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="smmC1B8Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFE31C4CEC7; Tue, 8 Oct 2024 13:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728393159; bh=1py/cpOwOB32tH1uJZ9jqE916YjdBh98DHYdJSxGhS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smmC1B8Q1694v3YkeKFqXqJKRhECbcNFOLPrpzD/kVz+a9rremK9mIgfcqEoPNC6R Wt3BFk4chUnRSjGLNFjTyBEEGoegrZRD9iHbIQg3BQPCq9t0CZnFnIzc/2nvrVWNnQ h6Rbt+1oP4rrqk0Uehq21NnRRJ1mrNjw6TtnFI34= 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 6.6 071/386] ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails Date: Tue, 8 Oct 2024 14:05:16 +0200 Message-ID: <20241008115632.256591130@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115629.309157387@linuxfoundation.org> References: <20241008115629.309157387@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 422c074ed2897..7debfd5ce0d86 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