]> git.baikalelectronics.ru Git - kernel.git/commit
md: protect md_unregister_thread from reentrancy
authorGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Fri, 29 Apr 2022 08:49:09 +0000 (16:49 +0800)
committerSong Liu <song@kernel.org>
Mon, 23 May 2022 06:07:21 +0000 (23:07 -0700)
commit749149e31952b62a6b936ccd6b9e91dd9e31b1cd
tree58e8575c119e1b6b69a440ccfee1efdb69a54611
parentd0d1827b643346a70328cf0d077205a5818a42e9
md: protect md_unregister_thread from reentrancy

Generally, the md_unregister_thread is called with reconfig_mutex, but
raid_message in dm-raid doesn't hold reconfig_mutex to unregister thread,
so md_unregister_thread can be called simulitaneously from two call sites
in theory.

Then after previous commit which remove the protection of reconfig_mutex
for md_unregister_thread completely, the potential issue could be worse
than before.

Let's take pers_lock at the beginning of function to ensure reentrancy.

Reported-by: Donald Buczek <buczek@molgen.mpg.de>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md.c