This is a note to let you know that I've just added the patch titled PM / devfreq: Unlock mutex and free devfreq struct in error path to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pm-devfreq-unlock-mutex-and-free-devfreq-struct-in-error-path.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8b50a7995770d41a2e8d9c422cd2882aca0dedd2 Mon Sep 17 00:00:00 2001 From: Lukasz Luba <lukasz.luba@xxxxxxx> Date: Mon, 15 Mar 2021 09:31:23 +0000 Subject: PM / devfreq: Unlock mutex and free devfreq struct in error path From: Lukasz Luba <lukasz.luba@xxxxxxx> 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@xxxxxxxxxxxxxxx> # v5.9+ Fixes: 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode") Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx> Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -818,7 +818,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) { Patches currently in stable-queue which might be from lukasz.luba@xxxxxxx are queue-5.11/pm-devfreq-unlock-mutex-and-free-devfreq-struct-in-error-path.patch