The patch titled Subject: zram: do not free same element pages in zram_meta_free has been added to the -mm tree. Its filename is zram-extend-zero-pages-to-same-element-pages-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/zram-extend-zero-pages-to-same-element-pages-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/zram-extend-zero-pages-to-same-element-pages-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Minchan Kim <minchan@xxxxxxxxxx> Subject: zram: do not free same element pages in zram_meta_free zhouxianrong pointed out that we shouldn't free same element pages in zram_meta_free. Otherwise, it will encounter oops due to invalid handle value. Link: http://lkml.kernel.org/r/20170207065741.GA2567@bbox Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> Cc: zhouxianrong <zhouxianrong@xxxxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff -puN drivers/block/zram/zram_drv.c~zram-extend-zero-pages-to-same-element-pages-fix drivers/block/zram/zram_drv.c --- a/drivers/block/zram/zram_drv.c~zram-extend-zero-pages-to-same-element-pages-fix +++ a/drivers/block/zram/zram_drv.c @@ -425,8 +425,11 @@ static void zram_meta_free(struct zram_m /* Free all pages that are still in this zram device */ for (index = 0; index < num_pages; index++) { unsigned long handle = meta->table[index].handle; - - if (!handle) + /* + * No memory is allocated for same element filled pages. + * Simply clear same page flag. + */ + if (!handle || zram_test_flag(meta, index, ZRAM_SAME)) continue; zs_free(meta->mem_pool, handle); _ Patches currently in -mm which might be from minchan@xxxxxxxxxx are zram-remove-waitqueue-for-io-done.patch zram-extend-zero-pages-to-same-element-pages-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html