]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/slab.c
mm: kasan: initial memory quarantine implementation
[karo-tx-linux.git] / mm / slab.c
index c11bf50079522f7ef60170301f629ac74c0aad0d..28864c0224300562b4dc8cf4098b6e87eb5b51cf 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3547,9 +3547,17 @@ free_done:
 static inline void __cache_free(struct kmem_cache *cachep, void *objp,
                                unsigned long caller)
 {
-       struct array_cache *ac = cpu_cache_get(cachep);
+       /* Put the object into the quarantine, don't touch it for now. */
+       if (kasan_slab_free(cachep, objp))
+               return;
+
+       ___cache_free(cachep, objp, caller);
+}
 
-       kasan_slab_free(cachep, objp);
+void ___cache_free(struct kmem_cache *cachep, void *objp,
+               unsigned long caller)
+{
+       struct array_cache *ac = cpu_cache_get(cachep);
 
        check_irq_off();
        kmemleak_free_recursive(objp, cachep->flags);