Commit 390b7ab5 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Yongqiang Liu
Browse files

md: protect md_unregister_thread from reentrancy

mainline inclusion
from mainline-v5.19-rc1
commit 1e267742
category: bugfix
bugzilla: 188227, https://gitee.com/openeuler/kernel/issues/I6AG8P


CVE: NA

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

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: default avatarDonald Buczek <buczek@molgen.mpg.de>
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 9ebfa4f9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment