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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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)


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]