public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <chanwoo@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] PM / devfreq: Fix double free in devfreq_event_add_edev()
Date: Tue, 9 Sep 2025 23:30:13 +0900	[thread overview]
Message-ID: <c288bc66-e34f-42e6-b2e7-debb8e1415ba@kernel.org> (raw)
In-Reply-To: <aMABnic3SVnYMvGc@stanley.mountain>

25. 9. 9. 19:29에 Dan Carpenter 이(가) 쓴 글:
> The put_device() function calls devfreq_event_release_edev() which frees
> "evdev".  Calling kfree() again is a double free.
> 
> Fixes: 430a1845c804 ("PM / devfreq: Fix memory leak in devfreq_event_add_edev()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/devfreq/devfreq-event.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
> index 34406c52b845..70219099c604 100644
> --- a/drivers/devfreq/devfreq-event.c
> +++ b/drivers/devfreq/devfreq-event.c
> @@ -328,7 +328,6 @@ struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
>  	ret = device_register(&edev->dev);
>  	if (ret < 0) {
>  		put_device(&edev->dev);
> -		kfree(edev);
>  		return ERR_PTR(ret);
>  	}
>  	dev_set_drvdata(&edev->dev, edev);

Firstly, I'm sorry that it my wrong review of patch[1].
[1] https://patchwork.kernel.org/project/linux-pm/patch/20250907113302.3353584-1-kaushlendra.kumar@intel.com/

As you mentioned, the above patch[1] doesn't be necessary.

Instead of applying your patch, I'll drop the patch[1].
I'm sorry to make the confusion.

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


      parent reply	other threads:[~2025-09-09 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 10:29 [PATCH next] PM / devfreq: Fix double free in devfreq_event_add_edev() Dan Carpenter
2025-09-09 11:55 ` Kumar, Kaushlendra
2025-09-09 14:30 ` 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=c288bc66-e34f-42e6-b2e7-debb8e1415ba@kernel.org \
    --to=chanwoo@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kaushlendra.kumar@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@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