Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2475352rdb; Sun, 3 Dec 2023 19:45:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbVh0iTIAHUFCJ0jZMS4SgP723k++hsuXGIqZNTxjLq6183STjNAYpN2W2il5WYMaLkWH8 X-Received: by 2002:a17:90b:4c88:b0:286:9d31:1a10 with SMTP id my8-20020a17090b4c8800b002869d311a10mr856513pjb.61.1701661522749; Sun, 03 Dec 2023 19:45:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701661522; cv=none; d=google.com; s=arc-20160816; b=wjtBNxC50dsQrYYt2C7KDEtV+bDAJOVwLFpoxlsK6kxJ+te/vOrGD+T6JFI3uem600 fbHDS/DkmGTJzHVwq6Xmgsn9vDgNi8vvIdGhh4xis1JbkkF24ixdbKITMiwGTn/SGyLB jAxHkWuDk/SCy5ZjKkZ4djjRVbOrnRH8/XKNnwkbDp6QfudvkumtKvSQxy4t8v5WEQ4N rokNBZz7qQdC8YJeaXMRsFonytpA/gQ+O3kC2JXUExcu9nO9edkJoL/TOzykrd1yFgj6 TWCPkJsrf90oKTMs5G6QnogkYEPwwqN0Ufo1DswuFqj0haZ9c7NnmtQndmO6mRBuDDO6 AuGg== 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; bh=RvptNCl7Ywecjat1JXmcomEMoYpIcdLQcNss9i6MF1k=; fh=Qr06Jl2SmKGxHywo38i+7SMfJrvy26lA47OMIQO+MBc=; b=zqHBHslBcUdiXk3BJk7irZ74XR1/h/whvT4a+KK208c17gbxglMsmP9rANjx+DtByQ LZHsra5B/9/GeOACDqfFu+UytCPW/Q5uXwWZNLnLfZjlBd1c+706gE9joeCt1QkYkaxg 07f0xHKvwQ9xZPk1PgdBN2RkHsGDljf9Zq0B2zDHGNXAKjoPs2Wxx041impAuAh5yu2c 8Te091IhuiTXo6ze+L94bHdr7jlDneDP8REV7yUoJ1iZs6O08x86Dl9meYl4fHwyzPPo BTn1Yly0I290CPR/y9qeu6XxwIXLQrk+PsLwpK//hg30l4AnseLaGvzUiwp9X+DuBZE8 83nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id i20-20020a17090adc1400b0028669f28affsi3559723pjv.165.2023.12.03.19.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 19:45:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 78EC680702D9; Sun, 3 Dec 2023 19:45:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbjLDDne (ORCPT + 99 others); Sun, 3 Dec 2023 22:43:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjLDDnc (ORCPT ); Sun, 3 Dec 2023 22:43:32 -0500 X-Greylist: delayed 37577 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 03 Dec 2023 19:43:36 PST Received: from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net [20.231.56.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D56BC4 for ; Sun, 3 Dec 2023 19:43:36 -0800 (PST) Received: from luzhipeng.223.5.5.5 (unknown [60.186.191.128]) by mail-app2 (Coremail) with SMTP id by_KCgCnrtbgSm1lZ41EAA--.54620S2; Mon, 04 Dec 2023 11:43:29 +0800 (CST) From: Zhipeng Lu To: alexious@zju.edu.cn Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table Date: Mon, 4 Dec 2023 11:43:09 +0800 Message-Id: <20231204034309.3290173-1-alexious@zju.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: by_KCgCnrtbgSm1lZ41EAA--.54620S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr43Xw47WrWUuryDWry5CFg_yoWkXrb_Ga y8Z3s7Wryj9Fn5u3W8AFsxWrZakF1F9r48u3WftanYqFyIvrn7u392grnxX3sxGFs3AFyD AF18Wr43Zrn3WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb2AFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j 6rxdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8GwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvE x4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU-miiUUUUU= X-CM-SenderInfo: qrsrjiarszq6lmxovvfxof0/ X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 03 Dec 2023 19:45:20 -0800 (PST) The rdev->pm.dpm.ps allocated by kcalloc should be freed in every following error-handling path. However, in the error-handling of rdev->pm.power_state[i].clock_info the rdev->pm.dpm.ps is not freed, resulting in a memleak in this function. Fixes: d70229f70447 ("drm/radeon/kms: add dpm support for trinity asics") Signed-off-by: Zhipeng Lu --- drivers/gpu/drm/radeon/trinity_dpm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 08ea1c864cb2..8bf56fb7b933 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c @@ -1727,6 +1727,7 @@ static int trinity_parse_power_table(struct radeon_device *rdev) non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; if (!rdev->pm.power_state[i].clock_info) + kfree(rdev->pm.dpm.ps); return -EINVAL; ps = kzalloc(sizeof(struct sumo_ps), GFP_KERNEL); if (ps == NULL) { -- 2.34.1