In the Linux kernel, the following vulnerability has been resolved:
md: call _mdstopwrites in mdstop
From the link [1], we can see raid1d was running even after the path raiddtr -> mdstop -> _mdstop.
Let's stop write first in destructor to align with normal md-raid to fix the KASAN issue.
[1]. https://lore.kernel.org/linux-raid/CAPhsuW5gc4AakdGNdF8ubpezAuDLFOYUO_sfMZcec6hQFm8nhg@mail.gmail.com/T/#m7f12bf90481c02c6d2da68c64aeed4779b7df74a