Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1383893rwn; Thu, 8 Sep 2022 19:18:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6llzj/wQ6jbMJvFh3i2OJYVaKSR+vEaXbhRcvmjrAndEhugDMw3g6Bg139I38qN135TOGB X-Received: by 2002:aa7:80d0:0:b0:52d:f9c6:bb14 with SMTP id a16-20020aa780d0000000b0052df9c6bb14mr11961646pfn.57.1662689891144; Thu, 08 Sep 2022 19:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662689891; cv=none; d=google.com; s=arc-20160816; b=fdP+GGvNxCekW2SJvDBue5DUCIe/R1kBjzlLQM5CSR3JRV1YNhBIzieAPf0NWc/F1w ZsaS4rYBXaESoVrEDjHypZXz1mqZ+pK9l7IovtF/+E7VlTdo5w1Zz/IzC6RwFuWWN8ah Aj4bp6plHdQOnqCyTaWcfkkVrO6Q6n9ez/GpOOdsp2IZpaU9aezRj4nvG4xDgtMFlG3Z zNMXMexBsPIZJ5ByJrJLRw+6ck8+2ntvyS/2QlysgL3bDrXByjNOob1A4jcb1LcvrpDj t01f0zcQdBdbJ5uejmVzmLHAMz7ZiLExDa8XrRC+eo07nuYQfzMARDNj6LU+KsW3Ytq3 YEzQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=x7cyzmPJRGxBZQlAz9Z1QZA/JLGMm0SYGiGBH3bNhVI=; b=SbL8p+iePaUgByOVAaUETfmsT9Ltmix1XAopVD3ukpWgIZdAAtd/8vAEhxQnAdyVcE O2F4SveELqg1oKskjCLhwAe6CuDlmF/qrIV1ea+1xtMXu1Ysx1Lx65JbLdy3FbjQ/gJD G5l68Gw3J4Eci294TPjAKIsEZHfHTIUo/NqpSA2xO1943+9Eb6nV8wrH5YeaoA3/GbQX +POHhocFi4k40HxiKT5jzql+yF9kiYhnIdbIXnaqBDZ9YDHfvSk99eeFSMbbLFngSQJf /XppHg8WsBCxWAwRiAxHvpHfkGA2eqTGWDXcJ7LQE+/0MHJ9P/gDekTzvbmAXeVFj2sN 0LxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=d8U99i0j; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a63ec4d000000b00419f8572858si396569pgj.755.2022.09.08.19.17.42; Thu, 08 Sep 2022 19:18: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=@gmail.com header.s=20210112 header.b=d8U99i0j; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiIICO4 (ORCPT + 99 others); Thu, 8 Sep 2022 22:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiIICOx (ORCPT ); Thu, 8 Sep 2022 22:14:53 -0400 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272261582B; Thu, 8 Sep 2022 19:14:39 -0700 (PDT) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-127dca21a7dso452983fac.12; Thu, 08 Sep 2022 19:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=x7cyzmPJRGxBZQlAz9Z1QZA/JLGMm0SYGiGBH3bNhVI=; b=d8U99i0j+TgEZ5Wpcr/CldmVP+uwq19VJNbujQF1/uhKb+fy5EnBQ3xFta/ipaGZLK xf2kd8rG6M29k3QR6AWyZUsFcKLIlDqXvRZst8kjkLplMlRxeSjd2UfAaODFiT6R80l+ x1WaYWWwzDiiZDknFPBOIvrRku3IQ8syp5M6iunjJzaoykd8S7WR/mfh5578I1m1Rbfh bkwA0XVcm5Lh+QqtuVfX7yW+BvJ6ieHPXXXVsIWjCo1g48CBYOPWPEU05cLsE2TkYW1W PbWkvIt+TqIN4EjNHyPnmV8inEK8so9Ub2Ap9ZWf+h/SPNpDsOzul6UBgMdxewXPvsyh 2R7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=x7cyzmPJRGxBZQlAz9Z1QZA/JLGMm0SYGiGBH3bNhVI=; b=ZD0rlYo6IqQNLDxK1ojAxEu+xuCHUSdJ+GK7HJRpIzO1lQ5dpwR5LUxuB2orskCPov hmrB9P5mmQe4cNnHlvqTeTDB0utZHmYQ5COJvS/wZ+bIgM3H1JNXSjPBDd97/mT0BJad veWeNsEfxBbnUKIn1wyScZDn0Pkk8qj01FstNVU9f/E++cmn4N7lqiFwloeU7Y0NrFqG /P8Ba7mXy4x+MftHEq4BV+LDrvNHM+HesghvzXBqg6m/dg1YbdxZ3iXI2qGnPyYklD7X BTGcvFsHHXg/jt3Klni/S18obqgVoSnT74U0GTjk0q5timGdXOcjXquovHwDQdB1B9iy 0l6A== X-Gm-Message-State: ACgBeo3wxWwv3u9uq6jKyJXojS3gBU5TDeWQfNkMYIisaInP79If9egh 43z5vLYU6yRcZesawGq2g/0vRAJL0H4= X-Received: by 2002:a05:6870:ea92:b0:127:b4fe:85b0 with SMTP id s18-20020a056870ea9200b00127b4fe85b0mr3772438oap.247.1662689678656; Thu, 08 Sep 2022 19:14:38 -0700 (PDT) Received: from macondo.. ([2804:431:e7cc:ed0b:fde6:d0df:8e59:d84f]) by smtp.gmail.com with ESMTPSA id e26-20020a9d561a000000b006370abdc976sm367325oti.58.2022.09.08.19.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 19:14:38 -0700 (PDT) From: Rafael Mendonca To: "Rafael J. Wysocki" , Len Brown , Sudeep Holla Cc: Rafael Mendonca , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPI: PCC: Fix memory leak in address space setup Date: Thu, 8 Sep 2022 23:13:47 -0300 Message-Id: <20220909021348.472674-1-rafaelmendsr@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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(). Fixes: 77e2a04745ff8 ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Rafael Mendonca --- drivers/acpi/acpi_pcc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index a12b55d81209..fe5ab0fdc3bf 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,7 @@ 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); + kfree(data); return AE_NO_MEMORY; } -- 2.34.1