]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
another .23 patch
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 13 Nov 2007 23:02:09 +0000 (15:02 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 13 Nov 2007 23:02:09 +0000 (15:02 -0800)
queue-2.6.23/series
queue-2.6.23/slub-fix-memory-leak-by-not-reusing-cpu_slab.patch [new file with mode: 0644]

index 588a54ea381246aefa64f9635c9bdcd9320261ce..4d4800c29423e5498abe80a865c62efd0868ba31 100644 (file)
@@ -35,3 +35,4 @@ usb-gadget-ether-prevent-oops-caused-by-error-interrupt-race.patch
 usb-mutual-exclusion-for-ehci-init-and-port-resets.patch
 mips-mt-fix-bug-in-multithreaded-kernels.patch
 mips-r1-fix-hazard-barriers-to-make-kernels-work-on-r2-also.patch
+slub-fix-memory-leak-by-not-reusing-cpu_slab.patch
diff --git a/queue-2.6.23/slub-fix-memory-leak-by-not-reusing-cpu_slab.patch b/queue-2.6.23/slub-fix-memory-leak-by-not-reusing-cpu_slab.patch
new file mode 100644 (file)
index 0000000..42a613a
--- /dev/null
@@ -0,0 +1,64 @@
+From clameter@sgi.com  Tue Nov 13 15:00:45 2007
+From: Christoph Lameter <clameter@sgi.com>
+Date: Mon, 5 Nov 2007 11:15:43 -0800 (PST)
+Subject: SLUB: Fix memory leak by not reusing cpu_slab
+To: stable@kernel.org
+Cc: linux-kernel@vger.kernel.org, Olivér Pintér <oliver.pntr@gmail.com>, Hugh Dickins <hugh@veritas.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Willy Tarreau <w@1wt.eu>
+Message-ID: <Pine.LNX.4.64.0711051114560.14913@schroedinger.engr.sgi.com>
+
+From: Christoph Lameter <clameter@sgi.com>
+
+patch 05aa345034de6ae9c77fb93f6a796013641d57d5 in mainline.
+
+SLUB: Fix memory leak by not reusing cpu_slab
+
+Fix the memory leak that may occur when we attempt to reuse a cpu_slab
+that was allocated while we reenabled interrupts in order to be able to
+grow a slab cache. The per cpu freelist may contain objects and in that
+situation we may overwrite the per cpu freelist pointer loosing objects.
+This only occurs if we find that the concurrently allocated slab fits
+our allocation needs.
+
+If we simply always deactivate the slab then the freelist will be properly
+reintegrated and the memory leak will go away.
+
+Signed-off-by: Christoph Lameter <clameter@sgi.com>
+Cc: Hugh Dickins <hugh@veritas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ mm/slub.c |   22 +---------------------
+ 1 file changed, 1 insertion(+), 21 deletions(-)
+
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -1501,28 +1501,8 @@ new_slab:
+       page = new_slab(s, gfpflags, node);
+       if (page) {
+               cpu = smp_processor_id();
+-              if (s->cpu_slab[cpu]) {
+-                      /*
+-                       * Someone else populated the cpu_slab while we
+-                       * enabled interrupts, or we have gotten scheduled
+-                       * on another cpu. The page may not be on the
+-                       * requested node even if __GFP_THISNODE was
+-                       * specified. So we need to recheck.
+-                       */
+-                      if (node == -1 ||
+-                              page_to_nid(s->cpu_slab[cpu]) == node) {
+-                              /*
+-                               * Current cpuslab is acceptable and we
+-                               * want the current one since its cache hot
+-                               */
+-                              discard_slab(s, page);
+-                              page = s->cpu_slab[cpu];
+-                              slab_lock(page);
+-                              goto load_freelist;
+-                      }
+-                      /* New slab does not fit our expectations */
++              if (s->cpu_slab[cpu])
+                       flush_slab(s, s->cpu_slab[cpu], cpu);
+-              }
+               slab_lock(page);
+               SetSlabFrozen(page);
+               s->cpu_slab[cpu] = page;