Commit 8181e8a7 authored by Ming Lei's avatar Ming Lei Committed by Jinjiang Tu
Browse files

zram: fix race between zram_reset_device() and disksize_store()

mainline inclusion
from mainline-v5.16-rc1
commit 6f163779
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TWVA
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6f1637795f2827d36aec9e0246487f5852e8abf7

-------------------------------------------

When the ->init_lock is released in zram_reset_device(), disksize_store()
can come in and try to allocate meta, but zram_reset_device() is freeing
free meta, so cause races.

Link: https://lore.kernel.org/linux-block/20210927163805.808907-1-mcgrof@kernel.org/T/#mc617f865a3fa2778e40f317ddf48f6447c20c073


Reported-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Link: https://lore.kernel.org/r/20211025025426.2815424-2-ming.lei@redhat.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarJinjiang Tu <tujinjiang@huawei.com>
parent de22a0cb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment