]> git.ipfire.org Git - thirdparty/linux.git/commit
loop: use READ_ONCE() to read lo->lo_state without locking
authorYongpeng Yang <yangyongpeng@xiaomi.com>
Mon, 15 Dec 2025 15:21:04 +0000 (23:21 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 15 Dec 2025 16:32:42 +0000 (09:32 -0700)
commit54891a96b7a90d77c32bd0a7d6c9987e5479a314
treec3b647b331056845a14d800bb19612fa34b2f731
parent9869d3a6fed381f3b98404e26e1afc75d680cbf9
loop: use READ_ONCE() to read lo->lo_state without locking

When lo->lo_mutex is not held, direct access may read stale data. This
patch uses READ_ONCE() to read lo->lo_state and data_race() to silence
code checkers, and changes all assignments to use WRITE_ONCE().

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c