[3.11.y.z extended stable] Patch "zram: avoid null access when fail to alloc meta" has been added to staging queue
Luis Henriques
luis.henriques at canonical.com
Mon Mar 17 11:05:28 UTC 2014
This is a note to let you know that I have just added a patch titled
zram: avoid null access when fail to alloc meta
to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Luis
------
>From 6adb52d8f44969875326b300f8be84846ed9c47a Mon Sep 17 00:00:00 2001
From: Minchan Kim <minchan at kernel.org>
Date: Mon, 3 Mar 2014 15:38:34 -0800
Subject: zram: avoid null access when fail to alloc meta
commit db5d711e2db776f18219b033e5dc4fb7e4264dd7 upstream.
zram_meta_alloc could fail so caller should check it. Otherwise, your
system will hang.
Signed-off-by: Minchan Kim <minchan at kernel.org>
Acked-by: Jerome Marchand <jmarchan at redhat.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
[ luis: backported to 3.11:
- zram is a staging driver in 3.11 kernel ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
drivers/staging/zram/zram_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index fc540ea..9f1cb4e0 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -620,6 +620,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 (zram->init_done) {
up_write(&zram->init_lock);
--
1.9.0
More information about the kernel-team
mailing list