In the Linux kernel, the following vulnerability has been resolved:
dm-raid: really frozen sync_thread during suspend
1) commit f52f5c71f3d4 ("md: fix stopping sync thread") remove MDRECOVERYFROZEN from _mdstopwrites() and doesn't realize that dm-raid relies on _mdstopwrites() to frozen syncthread indirectly. Fix this problem by adding MDRECOVERYFROZEN in mdstopwrites(), and since stopsyncthread() is only used for dm-raid in this case, also move stopsyncthread() to mdstopwrites(). 2) The flag MDRECOVERYFROZEN doesn't mean that sync thread is frozen, it only prevent new syncthread to start, and it can't stop the running sync thread; In order to frozen syncthread, after seting the flag, stopsyncthread() should be used. 3) The flag MDRECOVERYFROZEN doesn't mean that writes are stopped, use it as condition for mdstopwrites() in raidpostsuspend() doesn't look correct. Consider that reentrant stopsyncthread() do nothing, always call mdstopwrites() in raidpostsuspend(). 4) raidmessage can set/clear the flag MDRECOVERYFROZEN at anytime, and if MDRECOVERYFROZEN is cleared while the array is suspended, new syncthread can start unexpected. Fix this by disallow raidmessage() to change sync_thread status during suspend.
Note that after commit f52f5c71f3d4 ("md: fix stopping sync thread"), the test shell/lvconvert-raid-reshape.sh start to hang in stopsyncthread(), and with previous fixes, the test won't hang there anymore, however, the test will still fail and complain that ext4 is corrupted. And with this patch, the test won't hang due to stopsyncthread() or fail due to ext4 is corrupted anymore. However, there is still a deadlock related to dm-raid456 that will be fixed in following patches.