md/raid5-cache: Take mddev_lock in r5c_journal_mode_show()
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 8 Jun 2022 16:27:50 +0000 (10:27 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:14:31 +0000 (17:14 -0600)
commit78ede6a06f011b47d3c2c9dd5699b05bc3bf2dae
treeb72950b0760d788bf41606906d76542b95df0203
parentc629f345b436997e4483aff85ec93f32faf6e4e6
md/raid5-cache: Take mddev_lock in r5c_journal_mode_show()

The mddev->lock spinlock doesn't protect against the removal of
conf->log in r5l_exit_log() so conf->log may be freed before it
is used.

To fix this, take the mddev_lock() insteaad of the mddev->lock spinlock.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid5-cache.c