]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 May 2016 03:07:00 +0000 (20:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 May 2016 03:07:00 +0000 (20:07 -0700)
added patches:
cgroup-make-sure-a-parent-css-isn-t-freed-before-its-children.patch

queue-4.4/cgroup-make-sure-a-parent-css-isn-t-freed-before-its-children.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/cgroup-make-sure-a-parent-css-isn-t-freed-before-its-children.patch b/queue-4.4/cgroup-make-sure-a-parent-css-isn-t-freed-before-its-children.patch
new file mode 100644 (file)
index 0000000..bd6e5fc
--- /dev/null
@@ -0,0 +1,53 @@
+From 8bb5ef79bc0f4016ecf79e8dce6096a3c63603e4 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Thu, 21 Jan 2016 15:32:15 -0500
+Subject: cgroup: make sure a parent css isn't freed before its children
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 8bb5ef79bc0f4016ecf79e8dce6096a3c63603e4 upstream.
+
+There are three subsystem callbacks in css shutdown path -
+css_offline(), css_released() and css_free().  Except for
+css_released(), cgroup core didn't guarantee the order of invocation.
+css_offline() or css_free() could be called on a parent css before its
+children.  This behavior is unexpected and led to bugs in cpu and
+memory controller.
+
+The previous patch updated ordering for css_offline() which fixes the
+cpu controller issue.  While there currently isn't a known bug caused
+by misordering of css_free() invocations, let's fix it too for
+consistency.
+
+css_free() ordering can be trivially fixed by moving putting of the
+parent css below css_free() invocation.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/cgroup.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/kernel/cgroup.c
++++ b/kernel/cgroup.c
+@@ -4692,14 +4692,15 @@ static void css_free_work_fn(struct work
+       if (ss) {
+               /* css free path */
++              struct cgroup_subsys_state *parent = css->parent;
+               int id = css->id;
+-              if (css->parent)
+-                      css_put(css->parent);
+-
+               ss->css_free(css);
+               cgroup_idr_remove(&ss->css_idr, id);
+               cgroup_put(cgrp);
++
++              if (parent)
++                      css_put(parent);
+       } else {
+               /* cgroup free path */
+               atomic_dec(&cgrp->root->nr_cgrps);
index c0e441fd273d234ac6cfdbc0d30920879636a40c..958fba7625989190a8221190b5712e3fc2b25280 100644 (file)
@@ -107,3 +107,4 @@ mm-huge_memory-replace-vm_no_thp-vm_bug_on-with-actual-vma-check.patch
 numa-fix-proc-pid-numa_maps-for-thp.patch
 mm-vmscan-reclaim-highmem-zone-if-buffer_heads-is-over-limit.patch
 mm-hwpoison-fix-wrong-num_poisoned_pages-accounting.patch
+cgroup-make-sure-a-parent-css-isn-t-freed-before-its-children.patch