Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3158276pxf; Mon, 15 Mar 2021 03:03:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS3vpXSmZ+nIM1HNW6Xh+dlUZmeUegsgyv8X8uqd3q2hQQTo+zWaNjhk674zrIvtP0DcKA X-Received: by 2002:a17:906:4f8a:: with SMTP id o10mr22924827eju.484.1615802589547; Mon, 15 Mar 2021 03:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615802589; cv=none; d=google.com; s=arc-20160816; b=0yNq0pdYfM0Np4R/3RT1fIVjen9YP86bYFwWRAWluBwlhN4MGfQ7ZB9NpHWfslQB4c h4mzoQxaa5HL7zLXJzSJw1vgSWzxluSXrHw+DTXmiMlIXw/rsyTKt2y5ZBnDBi48W2Kk D31/++7p1e80ZGiOOhx0vAfWzKqbBeMjWyB0Gb6iLGorErbd94iiDS9N/8f2Nf2qBcIV rLeQRmNAy9Plxcv+XaH+45N4wztAdV1yEmHlU+gMHRbmmRFu69Fsx3UU5HHUBNxsQvG0 1qxEYJ0LXL0yfObNc26zQCScXPK1wp6R9YfS+jGJbhW1bMVzh8tRNsC/4pxRu/8LHV7V PVGQ== 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=yLG/tZylZ6Nls3a0BkFYrG7zmWtnAf7Q6rqkvUpWmko=; b=thmwwEiJ+LxH/t0019cDRJqnfpF27Nl4lsy3ssbvF/qXanpInnm3Gagb+Y4BXbnZqn wdTUHPl4Uge5Nn1e0UV7kvHsBSdJ23560YjfJNsyxzU4wcVQFqbLbJU5XSVd3wHnXwWE z24Wj46cCFxy27ujfYTZTr+kYS/iu13IVBGx/Qyy3KvFSBZhgDz34k2IpVnwhRs7HrD4 y1R23IHu+BNbgQe2t3ibtk47v6wVZ2q1hzkmIWborQCC8RGKbELPI21vHP8GFevZZV9h eSB4MEtMiCV0T3T+kbCAU2zZyXGdwnk6CyS4PTaLNh5cruta8MM5CkCOMLA74QCZvM/8 9Gfg== 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 ld16si10812408ejb.528.2021.03.15.03.02.45; Mon, 15 Mar 2021 03:03:09 -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 S229632AbhCOKBn (ORCPT + 99 others); Mon, 15 Mar 2021 06:01:43 -0400 Received: from foss.arm.com ([217.140.110.172]:57098 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbhCOKBS (ORCPT ); Mon, 15 Mar 2021 06:01:18 -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 8BE4D1FB; Mon, 15 Mar 2021 03:01:17 -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 71C1B3F70D; Mon, 15 Mar 2021 03:01:16 -0700 (PDT) Subject: Re: [PATCH v2] 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, stable@vger.kernel.org References: <20210315093123.20049-1-lukasz.luba@arm.com> From: Lukasz Luba Message-ID: Date: Mon, 15 Mar 2021 10:01:15 +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 On 3/15/21 9:54 AM, Chanwoo Choi wrote: > On 3/15/21 6:31 PM, 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. >> >> Cc: v5.9+ # v5.9+ >> Fixes: 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode") >> Signed-off-by: Lukasz Luba >> --- >> v2: >> - added fixes tag and CC stable v5.9+ >> - used capital letter in commit header >> >> >> 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) { >> > > > Applied it. Thanks. > Thank you Chanwoo! Regards, Lukasz