Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559484 > unrolled thread

[PATCH] slab: add a check for the first kmem_cache not to be destroyed

Started byKyunghwan Kwon <kwon@toanyone.net>
First post2017-01-16 08:10 +0100
Last post2017-01-16 08:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] slab: add a check for the first kmem_cache not to be destroyed Kyunghwan Kwon <kwon@toanyone.net> - 2017-01-16 08:10 +0100

#1559484 — [PATCH] slab: add a check for the first kmem_cache not to be destroyed

FromKyunghwan Kwon <kwon@toanyone.net>
Date2017-01-16 08:10 +0100
Subject[PATCH] slab: add a check for the first kmem_cache not to be destroyed
Message-ID<t09At-5gj-7@gated-at.bofh.it>
The first kmem_cache created at booting up is supposed neither mergeable
nor destroyable but was possible to destroy. So prevent it.

Signed-off-by: Kyunghwan Kwon <kwon@toanyone.net>
---
 mm/slab_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 1dfc209..2d30ace 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -744,7 +744,7 @@ void kmem_cache_destroy(struct kmem_cache *s)
 	bool need_rcu_barrier = false;
 	int err;
 
-	if (unlikely(!s))
+	if (unlikely(!s) || s->refcount == -1)
 		return;
 
 	get_online_cpus();
-- 
2.9.3 (Apple Git-75)

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web