lkml.org 
[lkml]   [2019]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/slub.c: re-randomize random_seq if necessary
Date
calculate_sizes() could be called in several places
like (red_zone/poison/order/store_user)_store() while
random_seq remains unchanged.

If random_seq is not NULL in calculate_sizes(), re-randomize it.

Signed-off-by: Peng Wang <rocking@whu.edu.cn>
---
mm/slub.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index 1e3d0ec4e200..2a9d18019545 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3583,6 +3583,15 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
if (oo_objects(s->oo) > oo_objects(s->max))
s->max = s->oo;

+#ifdef CONFIG_SLAB_FREELIST_RANDOM
+ if (unlikely(s->random_seq)) {
+ kfree(s->random_seq);
+ s->random_seq = NULL;
+ if (init_cache_random_seq(s))
+ return 0;
+ }
+#endif
+
return !!oo_objects(s->oo);
}

--
2.19.1
\
 
 \ /
  Last update: 2019-01-09 10:08    [W:0.040 / U:22.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site