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)
committerSong Liu <song@kernel.org>
Sun, 3 Jul 2022 14:55:37 +0000 (07:55 -0700)
commitc2270aede3a1059c43b5af0561374bde82b7d313
tree593f4f90e2d1942a45e0bdd883769fc707d8d899
parentf4eb3eb3a9d522ec7073cdfa3dc87facca585b08
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>
drivers/md/raid5-cache.c