aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2015-06-10 14:14:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-10 19:43:43 -0400
commit02f7b4145da113683ad64c74bf64605e16b71789 (patch)
treef3b5f68fdd7bf92d29e615284b28739d55abc089 /mm
parentf371763a79d5212c2cb216b46fa8af46ba56cee3 (diff)
zsmalloc: fix a null pointer dereference in destroy_handle_cache()
If zs_create_pool()->create_handle_cache()->kmem_cache_create() or pool->name allocation fails, zs_create_pool()->destroy_handle_cache() will dereference the NULL pool->handle_cachep. Modify destroy_handle_cache() to avoid this. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 08bd7a3d464a..a8b5e749e84e 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -289,7 +289,8 @@ static int create_handle_cache(struct zs_pool *pool)
289 289
290static void destroy_handle_cache(struct zs_pool *pool) 290static void destroy_handle_cache(struct zs_pool *pool)
291{ 291{
292 kmem_cache_destroy(pool->handle_cachep); 292 if (pool->handle_cachep)
293 kmem_cache_destroy(pool->handle_cachep);
293} 294}
294 295
295static unsigned long alloc_handle(struct zs_pool *pool) 296static unsigned long alloc_handle(struct zs_pool *pool)