Commit a6752bb
committed
dm-mirror: fix a tiny race condition
JIRA: https://issues.redhat.com/browse/RHEL-119008
Upstream Status: kernel/git/torvalds/linux.git
commit 829451b
Author: Mikulas Patocka <[email protected]>
Date: Tue Jun 3 18:53:17 2025 +0200
dm-mirror: fix a tiny race condition
There's a tiny race condition in dm-mirror. The functions queue_bio and
write_callback grab a spinlock, add a bio to the list, drop the spinlock
and wake up the mirrord thread that processes bios in the list.
It may be possible that the mirrord thread processes the bio just after
spin_unlock_irqrestore is called, before wakeup_mirrord. This spurious
wake-up is normally harmless, however if the device mapper device is
unloaded just after the bio was processed, it may be possible that
wakeup_mirrord(ms) uses invalid "ms" pointer.
Fix this bug by moving wakeup_mirrord inside the spinlock.
Signed-off-by: Mikulas Patocka <[email protected]>
Cc: [email protected]
Signed-off-by: Benjamin Marzinski <[email protected]>1 parent 4be0abf commit a6752bb
1 file changed
+2
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | 136 | | |
139 | 137 | | |
| 138 | + | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| |||
646 | 645 | | |
647 | 646 | | |
648 | 647 | | |
649 | | - | |
650 | 648 | | |
651 | 649 | | |
| 650 | + | |
652 | 651 | | |
653 | 652 | | |
654 | 653 | | |
| |||
0 commit comments