Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3139536pxf; Mon, 15 Mar 2021 02:24:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHHgc3nyn+9PsK8VqeKKBBLo34+9GA5hECEFdoOTZGsbpsmN6DaaRcuDxmeYGD20g68rgC X-Received: by 2002:a50:fe81:: with SMTP id d1mr3768625edt.308.1615800245200; Mon, 15 Mar 2021 02:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615800245; cv=none; d=google.com; s=arc-20160816; b=1Kuu/14AafDv7jBLYf7cGnTlyhSIvY4W4ry6GoTDgob0X1gE5GtYnarM/rAQZTnBmN BJ0XCex1uTVhqP529kX+V7zbmrx5y94Yle7SwHpNcTgzgnzrfUqlydSF9OxnZ008Q6Ip IDFsAuPksTktIgW7NLCygZ680Y42jlHrM7YMf0JeGNfzPlBguYecbxUKdzizJOxflHkR xVkIohwjDHhIuNUioJjdm43Kc39/T2b8MYsE4xd7jXL/X8BN1q11JH4JGx1Gd23rkmAG cbN/ECgCNbIxBaiu+K8Wfq43c+gbqMbiqpZahJurGfIG6dHdkAfTqlEJepBuu/9yoPxm I1qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=mFegCk9qhtSjqMMXsqLo9vgb/AF0L8bxMgeacYx+sUs=; b=tYIYTM9QiMQnDjUX6fVohLiKhgGGxR1sDUyDrNCGLHcN89EAmHDfOjM9xXJiXtRhzP vtYKDr6fcizROAsCPtyOktgYWyLuFVHEjrExkIBVVxHCY26VBqRaNgfzknSxYv9XQDYM zzxn2MpcS4Z3A9W2v6PY6c1F3+VdvV/YM9Uk8DgTvKyFYKSewFPORSGeBYttcdqLKtNu 1dpUOTbaq+l22oTyNp7505D9VfRjMQpgnKAcgEVfgWJYgc7/cyzi3QHlwJupkN2Fh+jA HA2X7gZNsBfsASGOAlfb1GC3CPAnVqMFYdSGvYcLWt8qtGZaS9Qe6pUYvQdoLqh39mWe 0hLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si10890310ejc.483.2021.03.15.02.23.42; Mon, 15 Mar 2021 02:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbhCOJWk (ORCPT + 99 others); Mon, 15 Mar 2021 05:22:40 -0400 Received: from foss.arm.com ([217.140.110.172]:54998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbhCOJWK (ORCPT ); Mon, 15 Mar 2021 05:22:10 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AFBBA1FB; Mon, 15 Mar 2021 02:22:09 -0700 (PDT) Received: from [10.57.12.51] (unknown [10.57.12.51]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 72EFB3F70D; Mon, 15 Mar 2021 02:22:08 -0700 (PDT) Subject: Re: [PATCH] PM / devfreq: unlock mutex and free devfreq struct in error path To: Chanwoo Choi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, myungjoo.ham@samsung.com, kyungmin.park@samsung.com References: <20210312184534.6423-1-lukasz.luba@arm.com> From: Lukasz Luba Message-ID: Date: Mon, 15 Mar 2021 09:22:07 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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+ # v5.8+ Regards, Lukasz