All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] zram: avoid null access when fail to alloc meta
@ 2014-02-25  1:08 Minchan Kim
  2014-02-25  1:08 ` [PATCH 2/2] zram: delete zram_init_device() function Minchan Kim
  2014-02-25  9:37 ` [PATCH 1/2] zram: avoid null access when fail to alloc meta Jerome Marchand
  0 siblings, 2 replies; 4+ messages in thread
From: Minchan Kim @ 2014-02-25  1:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nitin Gupta, Jerome Marchand, Sergey Senozhatsky, linux-kernel,
	Minchan Kim, stable

zram_meta_alloc could be failed so caller should check it.
Otherwise, your system will be hang.

Cc: <stable@vger.kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/block/zram/zram_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 5ec61be793d2..21aee3edcb25 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -554,6 +554,8 @@ static ssize_t disksize_store(struct device *dev,
 
 	disksize = PAGE_ALIGN(disksize);
 	meta = zram_meta_alloc(disksize);
+	if (!meta)
+		return -ENOMEM;
 	down_write(&zram->init_lock);
 	if (init_done(zram)) {
 		up_write(&zram->init_lock);
-- 
1.8.5.3


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

end of thread, other threads:[~2014-02-25 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25  1:08 [PATCH 1/2] zram: avoid null access when fail to alloc meta Minchan Kim
2014-02-25  1:08 ` [PATCH 2/2] zram: delete zram_init_device() function Minchan Kim
2014-02-25 10:51   ` Jerome Marchand
2014-02-25  9:37 ` [PATCH 1/2] zram: avoid null access when fail to alloc meta Jerome Marchand

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.