From patchwork Wed Oct 19 08:25:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp208010wrs; Wed, 19 Oct 2022 01:56:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4e3A/AoQ62qvR2F4Kw/8bM4v0GAsgyLPugME+CYXu2g5agyyw0SZ+s101iukIccT0r9Mao X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr6379090ede.128.1666169771181; Wed, 19 Oct 2022 01:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169771; cv=none; d=google.com; s=arc-20160816; b=x5Ojy4K5GDLe5fyyH/iw7zd2UH8N2VoPFzZV/PUWybaRTHmnrbTnHv/AMcWX9Q6sLN mDR0GQee7OsGpOrgVpO+GH4UYYelGk18/Bury6X0gVgYu3d1k60ijjVADH6XMOURkeCu xeejmTN640jWfgQ+2B/p9SHPGqYCwTmw1eMuKUI85NG+6AIgcXzCfHiiqUd+xne7u5/b SIcbTtJWxN5+uSeSnd1RHKhCc6uoyChQDATKKNs3Xpzgc0uY3fGXad7jp9kRc3dav6GA Jp91TlKZ3UpXaZM5Tq6bNxBZ3IItburLlugAyiPdaOwKVQtlQUjTnPAsejodKtzHm6XP 4FOg== 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=dIBVCNnZeRZSNphW4MC21isB7pjubjATRuANkcU4NOUp2tfZKZ4ILQTwUA6g59Ra70 V7/tshwNbaA1na0bIYkmgbQJe0YAKlx4xlMPLiO7CqwEUprnkf8oNIK9gDNcEBp/FQ9F AGoL9SeCWi9dCBbuoSYN8qklQlynmvDnVl4SkIdY9ZCtboPV7/EWRm5vHzuPQBpXAx+B JnnKgr6fDspStNVBU4jfG01HZaLZodULiJr9dCyOVfYjXviTMUKa6pFN9jxdxmX6fjKI k86eNCuotFKxI1UzYYdcO3xWhMMIUktnrv48hF09V1Nb/gjE1LSbJVsDW2PZEjargZNq V9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sbqncfVI; 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 bo17-20020a0564020b3100b0045c234508e2si11521815edb.627.2022.10.19.01.55.45; Wed, 19 Oct 2022 01:56:11 -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=sbqncfVI; 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 S231794AbiJSIwX (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiJSIua (ORCPT ); Wed, 19 Oct 2022 04:50:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CACB488; Wed, 19 Oct 2022 01:49:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0720C6182F; Wed, 19 Oct 2022 08:47:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F106C433D7; Wed, 19 Oct 2022 08:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169274; bh=njhw0LwRXIffYEP5C+Wa5eEtx0qNIV98IVTRB8jz/4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbqncfVIFbAi+LRSvqTDi/eC6dfAfK/fspn+hiEH54uRov+ymzxM3Pf/SlPCd3Awk z9nd9WqiQZ/NSfJrgwUhcoqUleNFKD/F8lcQYfX8eLZ0yfj2myH6Gv+olKmZEkltqc ZjW3dPCOoHJqyQ4OYIuI0DitdlXtD8fJgys3lF48= 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 6.0 217/862] ACPI: PCC: Release resources on address space setup failure path Date: Wed, 19 Oct 2022 10:25:04 +0200 Message-Id: <20221019083259.624066766@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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?1747105633805081421?= X-GMAIL-MSGID: =?utf-8?q?1747105633805081421?= 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; }