diff options
| author | Roman Kiryanov <rkir@google.com> | 2019-06-19 11:10:09 -0700 |
|---|---|---|
| committer | Roman Kiryanov <rkir@google.com> | 2019-06-19 11:13:03 -0700 |
| commit | f1adac4c222bda2d85b683f95069e974d8b9665f (patch) | |
| tree | 8b3c9042eb9697eb4eda2a630ac74c84dc03b5de /kernel | |
| parent | 9c4ab5729952b25289ad9bd64f1ea764d0c97d32 (diff) | |
ANDROID: kernel: cgroup: cpuset: Add missing allocation of cpus_requested in alloc_trial_cpuset
alloc_trial_cpuset missed allocation of the alloc_trial_cpuset
field which caused it to be shared from the base cs provided.
Once update_cpumask parsed buf into cpus_requested and updated
cpus_allowed, the result were never written to cs because
cs and trialcs shared the same pointer to cpus_requested and
cpus_requested always matched to itself and no updates were
written. This caused cpus_requested to be non-empty and
cpus_allowed empty.
This issue occurs only with CONFIG_CPUMASK_OFFSTACK enabled
(e.g. via CONFIG_MAXSMP).
Bug: 134051784
Bug: 120444281
Fixes: 4803def4e0b2 ("ANDROID: cpuset: Make cpusets restore on hotplug")
Test: enable CONFIG_CPUSETS, boot and check logcat that
Test: libprocessgroup does not fail with something similar to
Test: AddTidToCgroup failed to write '2354'; fd=93: No space left on device
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I866836b5c0acfde8349c250a510ee89d8d37cb8e
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/cpuset.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index db86d6b609b6..9ad9d458df1e 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -419,14 +419,19 @@ static struct cpuset *alloc_trial_cpuset(struct cpuset *cs) if (!alloc_cpumask_var(&trial->cpus_allowed, GFP_KERNEL)) goto free_cs; + if (!alloc_cpumask_var(&trial->cpus_requested, GFP_KERNEL)) + goto free_allowed; if (!alloc_cpumask_var(&trial->effective_cpus, GFP_KERNEL)) goto free_cpus; cpumask_copy(trial->cpus_allowed, cs->cpus_allowed); + cpumask_copy(trial->cpus_requested, cs->cpus_requested); cpumask_copy(trial->effective_cpus, cs->effective_cpus); return trial; free_cpus: + free_cpumask_var(trial->cpus_requested); +free_allowed: free_cpumask_var(trial->cpus_allowed); free_cs: kfree(trial); @@ -440,6 +445,7 @@ free_cs: static void free_trial_cpuset(struct cpuset *trial) { free_cpumask_var(trial->effective_cpus); + free_cpumask_var(trial->cpus_requested); free_cpumask_var(trial->cpus_allowed); kfree(trial); } |
