zram: avoid race between zram_remove and disksize_store
mainline inclusion from mainline-v5.16-rc1 commit 5a4b6536 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I674BF CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5a4b653655d554b5f51a5d2252882708c56a6f7e -------------------------------- After resetting device in zram_remove(), disksize_store still may come and allocate resources again before deleting gendisk, fix the race by resetting zram after del_gendisk() returns. At that time, disksize_store can't come any more. Reported-by: NLuis Chamberlain <mcgrof@kernel.org> Reviewed-by: NLuis Chamberlain <mcgrof@kernel.org> Signed-off-by: NMing Lei <ming.lei@redhat.com> Acked-by: NMinchan Kim <minchan@kernel.org> Link: https://lore.kernel.org/r/20211025025426.2815424-4-ming.lei@redhat.comSigned-off-by: NJens Axboe <axboe@kernel.dk> Conflicts: drivers/block/zram/zram_drv.c Signed-off-by: NLonglong Xia <xialonglong1@huawei.com> Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录