Message ID | 2a30f7bf-601b-f442-9664-7de5a1501206@linux.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/mm/slub.c b/mm/slub.c index c92d636..f39d06e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -290,6 +290,10 @@ static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp) { unsigned long freeptr_addr = (unsigned long)object + s->offset; +#ifdef CONFIG_SLAB_FREELIST_HARDENED + BUG_ON(object == fp); /* naive detection of double free or corruption */ +#endif + *(void **)freeptr_addr = freelist_ptr(s, fp, freeptr_addr); }