linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zsmalloc: fix a null pointer dereference in destroy_handle_cache()
@ 2015-06-05 11:11 Sergey Senozhatsky
  2015-06-08 20:55 ` Andrew Morton
  2015-06-10  0:03 ` Minchan Kim
  0 siblings, 2 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2015-06-05 11:11 UTC (permalink / raw)
  To: Andrew Morton, Minchan Kim
  Cc: linux-mm, linux-kernel, Sergey Senozhatsky, Sergey Senozhatsky

zs_destroy_pool()->destroy_handle_cache() invoked from
zs_create_pool() can pass a NULL ->handle_cachep pointer
to kmem_cache_destroy(), which will dereference it.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 mm/zsmalloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 33d5126..c766240 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -285,7 +285,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)
-- 
2.4.2.387.gf86f31a

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-10  0:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 11:11 [PATCH] zsmalloc: fix a null pointer dereference in destroy_handle_cache() Sergey Senozhatsky
2015-06-08 20:55 ` Andrew Morton
2015-06-09  0:38   ` Joonsoo Kim
2015-06-09  0:43     ` Andrew Morton
2015-06-09  3:57   ` Sergey Senozhatsky
2015-06-10  0:03 ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).