[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1393290516-21158-1-git-send-email-minchan@kernel.org>
Date: Tue, 25 Feb 2014 10:08:35 +0900
From: Minchan Kim <minchan@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Nitin Gupta <ngupta@...are.org>,
Jerome Marchand <jmarchan@...hat.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
linux-kernel@...r.kernel.org, Minchan Kim <minchan@...nel.org>,
<stable@...r.kernel.org>
Subject: [PATCH 1/2] zram: avoid null access when fail to alloc meta
zram_meta_alloc could be failed so caller should check it.
Otherwise, your system will be hang.
Cc: <stable@...r.kernel.org>
Signed-off-by: Minchan Kim <minchan@...nel.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists