public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	myungjoo.ham@samsung.com, kyungmin.park@samsung.com
Subject: Re: [PATCH] PM / devfreq: unlock mutex and free devfreq struct in error path
Date: Mon, 15 Mar 2021 09:22:07 +0000	[thread overview]
Message-ID: <ecd8866a-85a3-e2cc-7e35-06b3e2afb003@arm.com> (raw)
In-Reply-To: <aa65398e-6de6-92df-3c27-a8a7f43eda10@samsung.com>

Hi Chanwoo,

On 3/15/21 7:20 AM, Chanwoo Choi wrote:
> Hi Lukasz,
> 
> On 3/13/21 3:45 AM, Lukasz Luba wrote:
>> The devfreq->lock is held for time of setup. Release the lock in the
>> error path, before jumping to the end of the function.
>>
>> Change the goto destination which frees the allocated memory.
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>>   drivers/devfreq/devfreq.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
>> index b6d3e7db0b09..99b2eeedc238 100644
>> --- a/drivers/devfreq/devfreq.c
>> +++ b/drivers/devfreq/devfreq.c
>> @@ -822,7 +822,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
>>   
>>   	if (devfreq->profile->timer < 0
>>   		|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
>> -		goto err_out;
>> +		mutex_unlock(&devfreq->lock);
>> +		goto err_dev;
>>   	}
>>   
>>   	if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
>>
> 
> Looks good to me. But, need to add the following information
> and please use capital letter of the first character of patch title. Thanks.

thanks for looking at this, sure, I'll use the capital letter.

> 
> Fixes: 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode")
> 
> Also, need to send it to stable lkml.
> 

I'll add the 'Fixes' tag and send v2 also into stable v5.8+:

Cc: v5.8+ <stable@vger.kernel.org> # v5.8+

Regards,
Lukasz

      reply	other threads:[~2021-03-15  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210312184551epcas1p2fe579b2a736cac2814b8a236869c4c27@epcas1p2.samsung.com>
2021-03-12 18:45 ` [PATCH] PM / devfreq: unlock mutex and free devfreq struct in error path Lukasz Luba
2021-03-15  7:20   ` Chanwoo Choi
2021-03-15  9:22     ` Lukasz Luba [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=ecd8866a-85a3-e2cc-7e35-06b3e2afb003@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=cw00.choi@samsung.com \
    --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