All of lore.kernel.org
 help / color / mirror / Atom feed
* + zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch added to -mm tree
@ 2015-06-08 20:55 akpm
  2015-06-09  2:17 ` Sergey Senozhatsky
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2015-06-08 20:55 UTC (permalink / raw)
  To: sergey.senozhatsky, minchan, mm-commits


The patch titled
     Subject: zsmalloc: fix a null pointer dereference in destroy_handle_cache()
has been added to the -mm tree.  Its filename is
     zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: zsmalloc: fix a null pointer dereference in destroy_handle_cache()

If zs_create_pool()->create_handle_cache()->kmem_cache_create() 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>
---

 mm/zsmalloc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN mm/zsmalloc.c~zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache mm/zsmalloc.c
--- a/mm/zsmalloc.c~zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache
+++ a/mm/zsmalloc.c
@@ -289,7 +289,8 @@ static int create_handle_cache(struct zs
 
 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)
_

Patches currently in -mm which might be from sergey.senozhatsky@gmail.com are

zram-clear-disk-io-accounting-when-reset-zram-device.patch
zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch
zram-add-compact-sysfs-entry-to-documentation.patch
zram-cosmetic-zram_attr_ro-code-formatting-tweak.patch
zram-use-idr-instead-of-zram_devices-array.patch
zram-reorganize-code-layout.patch
zram-remove-max_num_devices-limitation.patch
zram-report-every-added-and-removed-device.patch
zram-trivial-correct-flag-operations-comment.patch
zram-return-zram-device_id-from-zram_add.patch
zram-close-race-by-open-overriding.patch
zram-add-dynamic-device-add-remove-functionality.patch
zram-cosmetic-zram_bvec_write-cleanup.patch
zram-cut-trailing-newline-in-algorithm-name.patch
zram-check-comp-algorithm-availability-earlier.patch
zram-check-comp-algorithm-availability-earlier-v2.patch
linux-next.patch


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

end of thread, other threads:[~2015-06-09  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 20:55 + zsmalloc-fix-a-null-pointer-dereference-in-destroy_handle_cache.patch added to -mm tree akpm
2015-06-09  2:17 ` Sergey Senozhatsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.