Commit f8e1ca9
Mikulas Patocka
dm-integrity: fix a race condition when accessing recalc_sector
There's a race condition when accessing the variable
ic->sb->recalc_sector. The function integrity_recalc writes to this
variable when it makes some progress and the function
dm_integrity_map_continue may read this variable concurrently.
One problem is that on 32-bit architectures the 64-bit variable is not
read and written atomically - it may be possible to read garbage if read
races with write.
Another problem is that memory accesses to this variable are not guarded
with memory barriers.
This commit fixes the race - it moves reading ic->sb->recalc_sector to an
earlier place where we hold &ic->endio_wait.lock.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org1 parent faada21 commit f8e1ca9
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2174 | 2174 | | |
2175 | 2175 | | |
2176 | 2176 | | |
| 2177 | + | |
2177 | 2178 | | |
2178 | 2179 | | |
2179 | 2180 | | |
| |||
2314 | 2315 | | |
2315 | 2316 | | |
2316 | 2317 | | |
| 2318 | + | |
2317 | 2319 | | |
2318 | 2320 | | |
2319 | 2321 | | |
| |||
2368 | 2370 | | |
2369 | 2371 | | |
2370 | 2372 | | |
2371 | | - | |
| 2373 | + | |
2372 | 2374 | | |
2373 | 2375 | | |
2374 | 2376 | | |
| |||
0 commit comments