mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
- fix a race condition in dm-integrity
-----BEGIN PGP SIGNATURE----- iIoEABYIADIWIQRnH8MwLyZDhyYfesYTAyx9YGnhbQUCZuGERRQcbXBhdG9ja2FA cmVkaGF0LmNvbQAKCRATAyx9YGnhbQDOAQDP5McFAyla+jgWuuZWr3yL6sOibQuN mHAIwFsiKhdEgwEA5lfHaI6gVCycoiGpmD5EhL4sZSgA4B3e3GXuHb/lRQ8= =wFGJ -----END PGP SIGNATURE----- Merge tag 'for-6.11/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm Pull device mapper fix from Mikulas Patocka: - fix a race condition in dm-integrity * tag 'for-6.11/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm-integrity: fix a race condition when accessing recalc_sector
This commit is contained in:
commit
3857c7b041
@ -2174,6 +2174,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
|
||||
struct bio *bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io));
|
||||
unsigned int journal_section, journal_entry;
|
||||
unsigned int journal_read_pos;
|
||||
sector_t recalc_sector;
|
||||
struct completion read_comp;
|
||||
bool discard_retried = false;
|
||||
bool need_sync_io = ic->internal_hash && dio->op == REQ_OP_READ;
|
||||
@ -2314,6 +2315,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
|
||||
goto lock_retry;
|
||||
}
|
||||
}
|
||||
recalc_sector = le64_to_cpu(ic->sb->recalc_sector);
|
||||
spin_unlock_irq(&ic->endio_wait.lock);
|
||||
|
||||
if (unlikely(journal_read_pos != NOT_FOUND)) {
|
||||
@ -2368,7 +2370,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
|
||||
if (need_sync_io) {
|
||||
wait_for_completion_io(&read_comp);
|
||||
if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) &&
|
||||
dio->range.logical_sector + dio->range.n_sectors > le64_to_cpu(ic->sb->recalc_sector))
|
||||
dio->range.logical_sector + dio->range.n_sectors > recalc_sector)
|
||||
goto skip_check;
|
||||
if (ic->mode == 'B') {
|
||||
if (!block_bitmap_op(ic, ic->recalc_bitmap, dio->range.logical_sector,
|
||||
|
Loading…
Reference in New Issue
Block a user