summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kasan.h4
-rw-r--r--mm/kasan/kasan.c2
-rw-r--r--mm/kasan/quarantine.c1
-rw-r--r--mm/slab_common.c4
4 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 820c0ad54a01..c908b25bf5a5 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -52,7 +52,7 @@ void kasan_free_pages(struct page *page, unsigned int order);
52void kasan_cache_create(struct kmem_cache *cache, size_t *size, 52void kasan_cache_create(struct kmem_cache *cache, size_t *size,
53 unsigned long *flags); 53 unsigned long *flags);
54void kasan_cache_shrink(struct kmem_cache *cache); 54void kasan_cache_shrink(struct kmem_cache *cache);
55void kasan_cache_destroy(struct kmem_cache *cache); 55void kasan_cache_shutdown(struct kmem_cache *cache);
56 56
57void kasan_poison_slab(struct page *page); 57void kasan_poison_slab(struct page *page);
58void kasan_unpoison_object_data(struct kmem_cache *cache, void *object); 58void kasan_unpoison_object_data(struct kmem_cache *cache, void *object);
@@ -98,7 +98,7 @@ static inline void kasan_cache_create(struct kmem_cache *cache,
98 size_t *size, 98 size_t *size,
99 unsigned long *flags) {} 99 unsigned long *flags) {}
100static inline void kasan_cache_shrink(struct kmem_cache *cache) {} 100static inline void kasan_cache_shrink(struct kmem_cache *cache) {}
101static inline void kasan_cache_destroy(struct kmem_cache *cache) {} 101static inline void kasan_cache_shutdown(struct kmem_cache *cache) {}
102 102
103static inline void kasan_poison_slab(struct page *page) {} 103static inline void kasan_poison_slab(struct page *page) {}
104static inline void kasan_unpoison_object_data(struct kmem_cache *cache, 104static inline void kasan_unpoison_object_data(struct kmem_cache *cache,
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index b2a0cff2bb35..25f0e6521f36 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -435,7 +435,7 @@ void kasan_cache_shrink(struct kmem_cache *cache)
435 quarantine_remove_cache(cache); 435 quarantine_remove_cache(cache);
436} 436}
437 437
438void kasan_cache_destroy(struct kmem_cache *cache) 438void kasan_cache_shutdown(struct kmem_cache *cache)
439{ 439{
440 quarantine_remove_cache(cache); 440 quarantine_remove_cache(cache);
441} 441}
diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index dae929c02bbb..6f1ed1630873 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -274,6 +274,7 @@ static void per_cpu_remove_cache(void *arg)
274 qlist_free_all(&to_free, cache); 274 qlist_free_all(&to_free, cache);
275} 275}
276 276
277/* Free all quarantined objects belonging to cache. */
277void quarantine_remove_cache(struct kmem_cache *cache) 278void quarantine_remove_cache(struct kmem_cache *cache)
278{ 279{
279 unsigned long flags, i; 280 unsigned long flags, i;
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 23ff74e61838..09d0e849b07f 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -528,6 +528,9 @@ static void slab_caches_to_rcu_destroy_workfn(struct work_struct *work)
528 528
529static int shutdown_cache(struct kmem_cache *s) 529static int shutdown_cache(struct kmem_cache *s)
530{ 530{
531 /* free asan quarantined objects */
532 kasan_cache_shutdown(s);
533
531 if (__kmem_cache_shutdown(s) != 0) 534 if (__kmem_cache_shutdown(s) != 0)
532 return -EBUSY; 535 return -EBUSY;
533 536
@@ -816,7 +819,6 @@ void kmem_cache_destroy(struct kmem_cache *s)
816 get_online_cpus(); 819 get_online_cpus();
817 get_online_mems(); 820 get_online_mems();
818 821
819 kasan_cache_destroy(s);
820 mutex_lock(&slab_mutex); 822 mutex_lock(&slab_mutex);
821 823
822 s->refcount--; 824 s->refcount--;