diff options
| author | Michael Lass <bevan@bi-co.net> | 2019-05-21 15:58:07 -0400 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2019-05-21 19:15:20 -0400 |
| commit | 51b86f9a8d1c4bb4e3862ee4b4c5f46072f7520d (patch) | |
| tree | 3a37a21670c6d37acacda2de65022d4671dd35d6 | |
| parent | 8454fca4f53bbe5e0a71613192674c8ce5c52318 (diff) | |
dm: make sure to obey max_io_len_target_boundary
Commit 61697a6abd24 ("dm: eliminate 'split_discard_bios' flag from DM
target interface") incorrectly removed code from
__send_changing_extent_only() that is required to impose a per-target IO
boundary on IO that exceeds max_io_len_target_boundary(). Otherwise
"special" IO (e.g. DISCARD, WRITE SAME, WRITE ZEROES) can write beyond
where allowed.
Fix this by restoring the max_io_len_target_boundary() limit in
__send_changing_extent_only()
Fixes: 61697a6abd24 ("dm: eliminate 'split_discard_bios' flag from DM target interface")
Cc: stable@vger.kernel.org # 5.1+
Signed-off-by: Michael Lass <bevan@bi-co.net>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
| -rw-r--r-- | drivers/md/dm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 1fb1333fefec..997385c1ca54 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -1469,7 +1469,7 @@ static unsigned get_num_write_zeroes_bios(struct dm_target *ti) | |||
| 1469 | static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti, | 1469 | static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti, |
| 1470 | unsigned num_bios) | 1470 | unsigned num_bios) |
| 1471 | { | 1471 | { |
| 1472 | unsigned len = ci->sector_count; | 1472 | unsigned len; |
| 1473 | 1473 | ||
| 1474 | /* | 1474 | /* |
| 1475 | * Even though the device advertised support for this type of | 1475 | * Even though the device advertised support for this type of |
| @@ -1480,6 +1480,8 @@ static int __send_changing_extent_only(struct clone_info *ci, struct dm_target * | |||
| 1480 | if (!num_bios) | 1480 | if (!num_bios) |
| 1481 | return -EOPNOTSUPP; | 1481 | return -EOPNOTSUPP; |
| 1482 | 1482 | ||
| 1483 | len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti)); | ||
| 1484 | |||
| 1483 | __send_duplicate_bios(ci, ti, num_bios, &len); | 1485 | __send_duplicate_bios(ci, ti, num_bios, &len); |
| 1484 | 1486 | ||
| 1485 | ci->sector += len; | 1487 | ci->sector += len; |
