[SRU][Yakkety][PATCH 1/1] mm/slub.c: fix random_seq offset destruction
Joseph Salisbury
joseph.salisbury at canonical.com
Fri Mar 10 18:56:33 UTC 2017
From: Sean Rees <sean at erifax.org>
BugLink: http://bugs.launchpad.net/bugs/1663991
Commit 210e7a43fa90 ("mm: SLUB freelist randomization") broke USB hub
initialisation as described in
https://bugzilla.kernel.org/show_bug.cgi?id=177551.
Bail out early from init_cache_random_seq if s->random_seq is already
initialised. This prevents destroying the previously computed
random_seq offsets later in the function.
If the offsets are destroyed, then shuffle_freelist will truncate
page->freelist to just the first object (orphaning the rest).
Fixes: 210e7a43fa90 ("mm: SLUB freelist randomization")
Link: http://lkml.kernel.org/r/20170207140707.20824-1-sean@erifax.org
Signed-off-by: Sean Rees <sean at erifax.org>
Reported-by: <userwithuid at gmail.com>
Cc: Christoph Lameter <cl at linux.com>
Cc: Pekka Enberg <penberg at kernel.org>
Cc: David Rientjes <rientjes at google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim at lge.com>
Cc: Thomas Garnier <thgarnie at google.com>
Cc: <stable at vger.kernel.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit a810007afe239d59c1115fcaa06eb5b480f876e9)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
mm/slub.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/slub.c b/mm/slub.c
index 379b796..0288bc5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1423,6 +1423,10 @@ static int init_cache_random_seq(struct kmem_cache *s)
int err;
unsigned long i, count = oo_objects(s->oo);
+ /* Bailout if already initialised */
+ if (s->random_seq)
+ return 0;
+
err = cache_random_seq_create(s, count, GFP_KERNEL);
if (err) {
pr_err("SLUB: Unable to initialize free list for %s\n",
--
2.7.4
More information about the kernel-team
mailing list