Commit faf65d4d authored by Minchan Kim's avatar Minchan Kim Committed by Jiri Slaby

zram: avoid null access when fail to alloc meta

commit db5d711e upstream.

zram_meta_alloc could fail so caller should check it.  Otherwise, your
system will hang.
Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent e00feda0
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment