[ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 6d2453c3dbc5f70eafc1c866289a90a1fc57ce18 WARNING: Author mismatch between patch and upstream commit: Backport author: Dominique Martinet<dominique.martinet@xxxxxxxxxxxxxxxxx> Commit author: Sergey Senozhatsky<senozhatsky@xxxxxxxxxxxx> Status in newer kernel trees: 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (exact SHA1) 5.15.y | Not found Note: The patch differs from the upstream commit: --- 1: 6d2453c3dbc5 ! 1: 70169b5d17a5 drivers/block/zram/zram_drv.c: do not keep dangling zcomp pointer after zram reset @@ Metadata ## Commit message ## drivers/block/zram/zram_drv.c: do not keep dangling zcomp pointer after zram reset + [ Upstream commit 6d2453c3dbc5f70eafc1c866289a90a1fc57ce18 ] + We do all reset operations under write lock, so we don't need to save ->disksize and ->comp to stack variables. Another thing is that ->comp is freed during zram reset, but comp pointer is not NULL-ed, so zram keeps @@ Commit message Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> + Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device") + Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> + Signed-off-by: Dominique Martinet <dominique.martinet@xxxxxxxxxxxxxxxxx> ## drivers/block/zram/zram_drv.c ## @@ drivers/block/zram/zram_drv.c: static int zram_rw_page(struct block_device *bdev, sector_t sector, @@ drivers/block/zram/zram_drv.c: static void zram_reset_device(struct zram *zram) set_capacity_and_notify(zram->disk, 0); part_stat_set_all(zram->disk->part0, 0); + up_write(&zram->init_lock); /* I/O operation under all of CPU are done so let's free */ - zram_meta_free(zram, disksize); + zram_meta_free(zram, zram->disksize); @@ drivers/block/zram/zram_drv.c: static void zram_reset_device(struct zram *zram) + zcomp_destroy(zram->comp); + zram->comp = NULL; reset_bdev(zram); + } - up_write(&zram->init_lock); --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |