Patch "Revert "cpufreq: Fix possible race in cpufreq online error path"" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Revert "cpufreq: Fix possible race in cpufreq online error path"

to the 5.15-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:
     revert-cpufreq-fix-possible-race-in-cpufreq-online-e.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 525b633fe9454cb1c84df985da02d97614d6dc72
Author: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Date:   Mon May 9 09:27:37 2022 +0530

    Revert "cpufreq: Fix possible race in cpufreq online error path"
    
    [ Upstream commit 85f0e42bd65d01b351d561efb38e584d4c596553 ]
    
    This reverts commit f346e96267cd76175d6c201b40f770c0116a8a04.
    
    The commit tried to fix a possible real bug but it made it even worse.
    The fix was simply buggy as now an error out to out_offline_policy or
    out_exit_policy will try to release a semaphore which was never taken in
    the first place. This works fine only if we failed late, i.e. via
    out_destroy_policy.
    
    Fixes: f346e96267cd ("cpufreq: Fix possible race in cpufreq online error path")
    Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 502245710ee0..cddf7e13c232 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1528,6 +1528,8 @@ static int cpufreq_online(unsigned int cpu)
 	for_each_cpu(j, policy->real_cpus)
 		remove_cpu_dev_symlink(policy, get_cpu_device(j));
 
+	up_write(&policy->rwsem);
+
 out_offline_policy:
 	if (cpufreq_driver->offline)
 		cpufreq_driver->offline(policy);
@@ -1536,9 +1538,6 @@ static int cpufreq_online(unsigned int cpu)
 	if (cpufreq_driver->exit)
 		cpufreq_driver->exit(policy);
 
-	cpumask_clear(policy->cpus);
-	up_write(&policy->rwsem);
-
 out_free_policy:
 	cpufreq_policy_free(policy);
 	return ret;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux