Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1977146rwe; Fri, 2 Sep 2022 06:53:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6n7mp8g0BZkXfIzS2a/8ym9ZfJ7q9V9bjisMH1T0busY2Q8bBHQtxO5oYgufJZn6+p6K2m X-Received: by 2002:a17:903:4c9:b0:172:f376:e9f1 with SMTP id jm9-20020a17090304c900b00172f376e9f1mr36369324plb.68.1662126830375; Fri, 02 Sep 2022 06:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662126830; cv=none; d=google.com; s=arc-20160816; b=L1KhfY8MJ+qq9JeUz36rTk62kYTrSiwviJkxKX01+qxdbPInnC1ZVfivBolyLfjwRf r91rx0OCeOdYusKmyIKTWhdesW7lP/uKjhk49k2fK7fO34ozBg/7tnO6bzVYID7t7yjx f8WP/ORSXPsUHXNSNmhSLPmPtdE2aPqW99XSZOFVYtqic6MkOs9uXJ0n6fFIaxPdpG+N HS/FKAN6a605cKBcemftJVLpgpNfpJRCHVDr81Jj3unVmPg0P70S99vxw0mgMNTbSfGQ R5W2mQkdoEPT9Du8LjSaz1y4+YOYi39/C7qOK4ktRS/mLzrHV5orNwlByE5SpqFGcwBa tFUw== 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=JS/VpE93AsS+U7EW4igvXJTfPQFRJyD8Bp9CdCB/69E=; b=O032TiWDQ0EK0ghDvq0JYIJY+LfuPJ3tuFGCTPWBswf7JQHwx2uycE/M3OgHuedokZ crgYzl+mXoXaSNsLWUU886oBLAl31SzS6ZcgFdDQ5aO90rxpRUwtBpY0nMHImBJRj/MJ yC32TG9pAHEO57gzSw3Axevk1jv1/WMNbmo5/59hTPRfLgD9yVSTlJTFIw/8h2031G7y 55/ON3IAO6bMqABx6oN7w+Y+RekPZSL47VdnyqSmDKl7JOypdVMBeS/4hzDpFmfABMrg ZEXs6z3IvMlMMIliAUdDO9oMFfXv/b6J1odQodZKNvNKxkuLfiMjRbfH2rAJogx0//zt fzNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dy5zOi8G; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a655248000000b00429a5de1176si2000777pgp.136.2022.09.02.06.53.38; Fri, 02 Sep 2022 06:53:50 -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=Dy5zOi8G; 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 S238009AbiIBMyq (ORCPT + 99 others); Fri, 2 Sep 2022 08:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238002AbiIBMxU (ORCPT ); Fri, 2 Sep 2022 08:53:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2688AF8F7C; Fri, 2 Sep 2022 05:37:46 -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 48EEDB82ADD; Fri, 2 Sep 2022 12:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99814C433D6; Fri, 2 Sep 2022 12:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662122204; bh=MpsjRacOxYFO0Y80lIecBuhnNRp1/Q76mn8eJIR1epI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dy5zOi8GRVPuPer19N5dc0NAnpogQVaR35T2w4OHD4LQxAuZIyuPQN1y0HAxNpqID jj7bkAwBJdq+MsJ4EEGh/D7gm14wwJ0n3g0Kw5OcmZXXEeDiYkCnc6wCeXnHWCPTm5 ggzFbzjkzDJcitJEJEqFzA7ByakquKkCEu91Nml0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Zhen Ni , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 45/72] drm/amd/pm: Fix a potential gpu_metrics_table memory leak Date: Fri, 2 Sep 2022 14:19:21 +0200 Message-Id: <20220902121406.251815602@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121404.772492078@linuxfoundation.org> References: <20220902121404.772492078@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,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 From: Zhen Ni [ Upstream commit 5afb76522a0af0513b6dc01f84128a73206b051b ] Memory is allocated for gpu_metrics_table in smu_v13_0_4_init_smc_tables(), but not freed in smu_v13_0_4_fini_smc_tables(). This may cause memory leaks, fix it. Reviewed-by: Evan Quan Signed-off-by: Zhen Ni Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c index 5a17b51aa0f9f..7df360c25d51e 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c @@ -190,6 +190,9 @@ static int smu_v13_0_4_fini_smc_tables(struct smu_context *smu) kfree(smu_table->watermarks_table); smu_table->watermarks_table = NULL; + kfree(smu_table->gpu_metrics_table); + smu_table->gpu_metrics_table = NULL; + return 0; } -- 2.35.1