From: Chanwoo Choi <cwchoi00@gmail.com>
To: Miaoqian Lin <linmq006@gmail.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events
Date: Sat, 18 Jun 2022 23:18:02 +0900 [thread overview]
Message-ID: <7bffaa3c-dda8-44f5-8190-9fb5142925bc@gmail.com> (raw)
In-Reply-To: <20220526082856.37594-1-linmq006@gmail.com>
On 22. 5. 26. 17:28, Miaoqian Lin wrote:
> of_get_child_by_name() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> This function only calls of_node_put() in normal path,
> missing it in error paths.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: f262f28c1470 ("PM / devfreq: event: Add devfreq_event class")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/devfreq/event/exynos-ppmu.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
> index 9b849d781116..a443e7c42daf 100644
> --- a/drivers/devfreq/event/exynos-ppmu.c
> +++ b/drivers/devfreq/event/exynos-ppmu.c
> @@ -519,15 +519,19 @@ static int of_get_devfreq_events(struct device_node *np,
>
> count = of_get_child_count(events_np);
> desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL);
> - if (!desc)
> + if (!desc) {
> + of_node_put(events_np);
> return -ENOMEM;
> + }
> info->num_events = count;
>
> of_id = of_match_device(exynos_ppmu_id_match, dev);
> if (of_id)
> info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
> - else
> + else {
> + of_node_put(events_np);
> return -EINVAL;
> + }
>
> j = 0;
> for_each_child_of_node(events_np, node) {
I edited the patch title with 'PM / ' prefix
in order to keep the consistent style of title as following:
PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events
--
Best Regards,
Samsung Electronics
Chanwoo Choi
prev parent reply other threads:[~2022-06-18 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 8:28 [PATCH] devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events Miaoqian Lin
2022-06-18 14:10 ` Chanwoo Choi
2022-06-18 14:18 ` Chanwoo Choi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7bffaa3c-dda8-44f5-8190-9fb5142925bc@gmail.com \
--to=cwchoi00@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).