Message ID | 20221108072302.736-1-judy.chenhui@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2528019wru; Mon, 7 Nov 2022 22:55:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM4ToJrPJy6hjtJuVZaNEUz2I0qvMGQ9iPdB9kPxG5LO9z1KCDsikFL3VcCiMgImFT0jsl6T X-Received: by 2002:a63:2d86:0:b0:438:6d6d:70b8 with SMTP id t128-20020a632d86000000b004386d6d70b8mr960635pgt.16.1667890511957; Mon, 07 Nov 2022 22:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667890511; cv=none; d=google.com; s=arc-20160816; b=dl//dM1jNpQ6RzYPUtJmgQXJTm1KmtcdWAIKu/xDW0RXo5JCpcapvuapDmNXGXC69g 5E5YfFWyj6uJ2dW2lQRPdLVd5BzbWyvtnWybkecpBotzzO0IktJ921FaiASazru9gMGA SlXv9sNM1bJ9gpdKQ/mQrM3qjfT4xXI1EnmyiETD+aObcic6SzTj3l8dJDNyq9WxmRXu Jq8b4XalL4d+i6I8VyLyfOeVYeYF55LQgajHIlwzdoQEQzhgEl0SkFQEKMl5iHMZY8U6 SU5h0vWhNq1GHVWpw1W0uTbJmZTiIYwzDLfcKJb/wXObA87w+CnUnzUP8xWDm3re+y6l JLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=9U8V+bDMaJloqkoVq3iJ1dXjhsNLKqVQ9KajG/HK66o=; b=AfUsKcRglTgRFOPuueD848+dbCyWtcbUY+3UJ27jTzFpZEXTNDzSD8ZkDJNtb26iio fBWh4ct/hJlsfjwWN10WZ/Z3Cc8YAh4LfytMJrdvfrfitsU3iKYWR/VlRpLxjqlujVw6 VAEaKhiroGfnDJhRsEImNmSQZYt7poXJSCK0PjUbL8IoiTZ8aOTRA/XRFlo2dNBdyAHZ 4BSvJ5igqLtXVWvXmUARxA1xiq+RUxtrf6j8nGiV3f+Lec7wZ1lHy2U6jpOfacYfWPds 7d7p3Mkcd8bYp+bcqSIZg+ts9OAdW7ChwGYn0wuOKHBYTlC/FFBFw9SHdzUX9656JH4l Jz9Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a63e815000000b00434dd6f6e21si13021415pgh.125.2022.11.07.22.54.58; Mon, 07 Nov 2022 22:55:11 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229478AbiKHGyQ (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Tue, 8 Nov 2022 01:54:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiKHGyP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 01:54:15 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86B41FCC4; Mon, 7 Nov 2022 22:54:13 -0800 (PST) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N5zJ83CWFzpVxg; Tue, 8 Nov 2022 14:50:32 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 14:54:11 +0800 Received: from huawei.com (10.67.174.191) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 14:54:11 +0800 From: Chen Hui <judy.chenhui@huawei.com> To: <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@somainline.org>, <rafael@kernel.org>, <viresh.kumar@linaro.org>, <sibis@codeaurora.org>, <mka@chromium.org> CC: <linux-arm-msm@vger.kernel.org>, <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Chen Hui <judy.chenhui@huawei.com> Subject: [PATCH] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_read_lut() Date: Tue, 8 Nov 2022 15:23:02 +0800 Message-ID: <20221108072302.736-1-judy.chenhui@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.191] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748909961855800961?= X-GMAIL-MSGID: =?utf-8?q?1748909961855800961?= |
Series |
cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_read_lut()
|
|
Commit Message
Chen Hui
Nov. 8, 2022, 7:23 a.m. UTC
If "cpu_dev" fails to get opp table in qcom_cpufreq_hw_read_lut(),
the program will return, resulting in "table" resource is not released.
Fixes: 51c843cf77bb ("cpufreq: qcom: Update the bandwidth levels on frequency change")
Signed-off-by: Chen Hui <judy.chenhui@huawei.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
1 file changed, 1 insertion(+)
Comments
Hey Chen, Thanks for the patch. On 11/8/22 12:53, Chen Hui wrote: > If "cpu_dev" fails to get opp table in qcom_cpufreq_hw_read_lut(), > the program will return, resulting in "table" resource is not released. > > Fixes: 51c843cf77bb ("cpufreq: qcom: Update the bandwidth levels on frequency change") Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com> > Signed-off-by: Chen Hui <judy.chenhui@huawei.com> > --- > drivers/cpufreq/qcom-cpufreq-hw.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c > index 833589bc95e4..d15097549e8c 100644 > --- a/drivers/cpufreq/qcom-cpufreq-hw.c > +++ b/drivers/cpufreq/qcom-cpufreq-hw.c > @@ -193,6 +193,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev, > } > } else if (ret != -ENODEV) { > dev_err(cpu_dev, "Invalid opp table in device tree\n"); > + kfree(table); > return ret; > } else { > policy->fast_switch_possible = true;
On 08-11-22, 15:23, Chen Hui wrote: > If "cpu_dev" fails to get opp table in qcom_cpufreq_hw_read_lut(), > the program will return, resulting in "table" resource is not released. > > Fixes: 51c843cf77bb ("cpufreq: qcom: Update the bandwidth levels on frequency change") > Signed-off-by: Chen Hui <judy.chenhui@huawei.com> > --- > drivers/cpufreq/qcom-cpufreq-hw.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c > index 833589bc95e4..d15097549e8c 100644 > --- a/drivers/cpufreq/qcom-cpufreq-hw.c > +++ b/drivers/cpufreq/qcom-cpufreq-hw.c > @@ -193,6 +193,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev, > } > } else if (ret != -ENODEV) { > dev_err(cpu_dev, "Invalid opp table in device tree\n"); > + kfree(table); > return ret; > } else { > policy->fast_switch_possible = true; Applied. Thanks.
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 833589bc95e4..d15097549e8c 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -193,6 +193,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev, } } else if (ret != -ENODEV) { dev_err(cpu_dev, "Invalid opp table in device tree\n"); + kfree(table); return ret; } else { policy->fast_switch_possible = true;