From patchwork Sat Oct 22 07:21:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1150445wrr; Sat, 22 Oct 2022 03:58:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f+TBP08ICXHuJ3fmxppSBO3TXjw77yTjHg8v0ZVGdSue6AhQLIoUGwi06Wa5ZrfMvoMs8 X-Received: by 2002:a17:907:78a:b0:78d:9ac7:b697 with SMTP id xd10-20020a170907078a00b0078d9ac7b697mr19104892ejb.457.1666436282269; Sat, 22 Oct 2022 03:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436282; cv=none; d=google.com; s=arc-20160816; b=Wj8u2B4NH27yVO0lRFi6Dl5xR5iuUEjPjbZXw7HT4Xa0qusekcIYlgkzopV5hsBROG Tmvte2Lvxo8OOgfsYt4pcIQ+CDOUUGWBVz96+2mAgZA81iIfdQxo/H5EFA3EqWGTihOg yZaLvYtTw3QE1bZ8k+sCyh6ozV+ImVmY8LvNkWaU5vQCkHTl7SA30D9n+cDTYZAVlP/S F5I7ryvmWSz6cZM/vH8nky7q1lrfBud+tGwzSv/yd4okU4XxYGXwLEQlT0YJ3coxWTve p/JoAk21oKFPbswpP3uoNkUQOceaWSzqmZivr696DGXjhJPHGJjHJZW8j+N8kogkxK8g utAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nXlo97dBJgGJFNZgYXrHpgQdVUb2GgL8IZN6haLyEeE=; b=EbUC+50ECG8WfVQCElxre/+o9pWzQO6xEf4sybefqpR0fHIsReYzODYPA/zjYn6wLw x1GAz/R1TcqbsvVcAbfZ+7boEQ+7GKfmFbaXVWnp8IeabfqOzRQ2uZnrqhRIxMmLAHQi 555YMn3razwMLgxUqtN54Ccj5Wx8yU3hLoKpdEsY2vIf/4IpYIEnw+NTyvmTUXNhyCDL 6LVzMOgpQjEg5NDwxILl96GZOSEiPUcdSbHxlDIILjorIMlUkFN6BMafTv6pZ7QA9Y1H gAwV3k6aWo1fSQ2RxWFwL/MZ7XPvpsdfSekoqMeq1R0omxAKoQtAf6ttAcs3TCEqBQuI muGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIS7pPwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv20-20020a17090760d400b00791a67e4c00si11372233ejc.835.2022.10.22.03.57.37; Sat, 22 Oct 2022 03:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIS7pPwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiJVKuZ (ORCPT + 99 others); Sat, 22 Oct 2022 06:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbiJVKuF (ORCPT ); Sat, 22 Oct 2022 06:50:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0039F10041D; Sat, 22 Oct 2022 03:07:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEE85B82DE2; Sat, 22 Oct 2022 07:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56577C433D6; Sat, 22 Oct 2022 07:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424557; bh=njhw0LwRXIffYEP5C+Wa5eEtx0qNIV98IVTRB8jz/4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIS7pPwbSIna8eki4KRjbhI5p4TrC8LX4ZKI4LIu5OmYHz1WlV6ltT8/vjiFIkDWQ GL4MoGGi6eDZTfAiKh4ovISDz/lmN8xIpdqvOLtRIoUabSE0ILqUr55D+YbYuJMXXg LoeHndGkFnJ1tb15hRqur9uAP60CaG/MMt2f1a6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 190/717] ACPI: PCC: Release resources on address space setup failure path Date: Sat, 22 Oct 2022 09:21:09 +0200 Message-Id: <20221022072449.227831824@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747385091151263084?= X-GMAIL-MSGID: =?utf-8?q?1747385091151263084?= From: Rafael Mendonca [ Upstream commit f890157e61b85ce8ae01a41ffa375e3b99853698 ] The allocated memory for the pcc_data struct doesn't get freed under an error path in pcc_mbox_request_channel() or acpi_os_ioremap(). Also, the PCC mailbox channel doesn't get freed under an error path in acpi_os_ioremap(). Fixes: 77e2a04745ff8 ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Rafael Mendonca Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index a12b55d81209..84f1ac416b57 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -63,6 +63,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (IS_ERR(data->pcc_chan)) { pr_err("Failed to find PCC channel for subspace %d\n", ctx->subspace_id); + kfree(data); return AE_NOT_FOUND; } @@ -72,6 +73,8 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (!data->pcc_comm_addr) { pr_err("Failed to ioremap PCC comm region mem for %d\n", ctx->subspace_id); + pcc_mbox_free_channel(data->pcc_chan); + kfree(data); return AE_NO_MEMORY; }