Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575759

[PATCH] mm/slub: Fix random_seq offset destruction

From Sean Rees <sean@erifax.org>
Newsgroups linux.kernel
Subject [PATCH] mm/slub: Fix random_seq offset destruction
Date 2017-02-07 15:10 +0100
Message-ID <t8eD0-3TA-19@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Bailout 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).

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=177551.

Signed-off-by: Sean Rees <sean@erifax.org>
---
 mm/slub.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index 7aa6f43..7ec0a96 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1422,6 +1422,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.9.3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm/slub: Fix random_seq offset destruction Sean Rees <sean@erifax.org> - 2017-02-07 15:10 +0100
  Re: [PATCH] mm/slub: Fix random_seq offset destruction Thomas Garnier <thgarnie@google.com> - 2017-02-07 16:50 +0100
    Re: [PATCH] mm/slub: Fix random_seq offset destruction Andrew Morton <akpm@linux-foundation.org> - 2017-02-07 23:00 +0100

csiph-web