diff options
author | Minchan Kim <minchan@kernel.org> | 2014-03-03 23:38:34 (GMT) |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-03-22 21:01:47 (GMT) |
commit | faf65d4dccfd705ff302e4e7b59fcb454f3b47ce (patch) | |
tree | 538f3d3e029a3de539bd7e1ee5636670825c6da4 /drivers/staging | |
parent | e00feda0d79196595eb0c12cd15b0b9015830190 (diff) | |
download | linux-fsl-qoriq-faf65d4dccfd705ff302e4e7b59fcb454f3b47ce.tar.xz |
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@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/zram/zram_drv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index d7ac040..d02088f 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -621,6 +621,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); |