aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2017-01-23 22:40:10 -0500
committerMoyster <oysterized@gmail.com>2018-05-16 13:23:44 +0200
commit0b71db97a50218f16fd49d39907710cf24fed0d7 (patch)
tree43cfbbc189afd7e8478fea7f8eebea12178fb8dd
parentc9eb9030eb59dc92cdf36e732d177fb9f50d5fdd (diff)
add slub sanitization
-rw-r--r--mm/slub.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index b3d553072..05895b54a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2830,6 +2830,13 @@ static __always_inline void slab_free(struct kmem_cache *s,
slab_free_hook(s, x);
+ if (!(s->flags & (SLAB_DESTROY_BY_RCU | SLAB_POISON))) {
+ size_t offset = s->offset ? 0 : sizeof(void *);
+ memset(x + offset, 0, s->object_size - offset);
+ if (s->ctor)
+ s->ctor(x);
+ }
+
redo:
/*
* Determine the currently cpus per cpu slab.