stable.vger.kernel.org archive mirror
 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  9:37 ` Jerome Marchand
  0 siblings, 1 reply; 2+ 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] 2+ messages in thread

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

Thread overview: 2+ 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  9:37 ` Jerome Marchand

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).