[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210512144820.787876754@linuxfoundation.org>
Date: Wed, 12 May 2021 16:42:22 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Lukasz Luba <lukasz.luba@....com>,
Chanwoo Choi <cw00.choi@...sung.com>
Subject: [PATCH 5.10 032/530] PM / devfreq: Unlock mutex and free devfreq struct in error path
From: Lukasz Luba <lukasz.luba@....com>
commit 8b50a7995770d41a2e8d9c422cd2882aca0dedd2 upstream.
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+ <stable@...r.kernel.org> # v5.9+
Fixes: 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode")
Signed-off-by: Lukasz Luba <lukasz.luba@....com>
Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/devfreq/devfreq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -788,7 +788,8 @@ struct devfreq *devfreq_add_device(struc
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) {
Powered by blists - more mailing lists