diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 55db72dae2196e..2ecf089a9ecbb8 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3341,14 +3341,17 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) void cpuset_cpus_allowed_fallback(struct task_struct *tsk) { - const struct cpumask *cs_mask = task_cs(tsk)->cpus_allowed; const struct cpumask *possible_mask = task_cpu_possible_mask(tsk); + const struct cpumask *cs_mask; + + rcu_read_lock(); + cs_mask = task_cs(tsk)->cpus_allowed; if (!is_in_v2_mode() || !cpumask_subset(cs_mask, possible_mask)) - return; /* select_fallback_rq will try harder */ + goto unlock; /* select_fallback_rq will try harder */ - rcu_read_lock(); do_set_cpus_allowed(tsk, cs_mask); +unlock: rcu_read_unlock(); /*