OSDN Git Service

zsmalloc: fix a null pointer dereference in destroy_handle_cache()
[uclinux-h8/linux.git] / mm / zsmalloc.c
index 08bd7a3..a8b5e74 100644 (file)
@@ -289,7 +289,8 @@ static int create_handle_cache(struct zs_pool *pool)
 
 static void destroy_handle_cache(struct zs_pool *pool)
 {
-       kmem_cache_destroy(pool->handle_cachep);
+       if (pool->handle_cachep)
+               kmem_cache_destroy(pool->handle_cachep);
 }
 
 static unsigned long alloc_handle(struct zs_pool *pool)