On Tue, May 14, 2019 at 04:35:34PM +0200, Alexander Potapenko wrote: > [...] > diff --git a/mm/slab.h b/mm/slab.h > index 43ac818b8592..24ae887359b8 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -524,4 +524,20 @@ static inline int cache_random_seq_create(struct kmem_cache *cachep, > [...] > +static inline bool slab_want_init_on_free(struct kmem_cache *c) > +{ > + if (static_branch_unlikely(&init_on_free)) > + return !(c->ctor); BTW, why is this checking for c->ctor here? Shouldn't it not matter for the free case? > + else > + return false; > +} -- Kees Cook