Skip to content

Commit d4b7799

Browse files
committed
Merge tag 'for-6.17/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mikulas Patocka: - fix integer overflow in dm-stripe - limit tag size in dm-integrity to 255 bytes - fix 'alignment inconsistency' warning in dm-raid * tag 'for-6.17/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm-raid: don't set io_min and io_opt for raid1 dm-integrity: limit MAX_TAG_SIZE to 255 dm-stripe: fix a possible integer overflow
2 parents b6f456a + a865562 commit d4b7799

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

drivers/md/dm-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct journal_sector {
133133
commit_id_t commit_id;
134134
};
135135

136-
#define MAX_TAG_SIZE (JOURNAL_SECTOR_DATA - JOURNAL_MAC_PER_SECTOR - offsetof(struct journal_entry, last_bytes[MAX_SECTORS_PER_BLOCK]))
136+
#define MAX_TAG_SIZE 255
137137

138138
#define METADATA_PADDING_SECTORS 8
139139

drivers/md/dm-raid.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3813,8 +3813,10 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
38133813
struct raid_set *rs = ti->private;
38143814
unsigned int chunk_size_bytes = to_bytes(rs->md.chunk_sectors);
38153815

3816-
limits->io_min = chunk_size_bytes;
3817-
limits->io_opt = chunk_size_bytes * mddev_data_stripes(rs);
3816+
if (chunk_size_bytes) {
3817+
limits->io_min = chunk_size_bytes;
3818+
limits->io_opt = chunk_size_bytes * mddev_data_stripes(rs);
3819+
}
38183820
}
38193821

38203822
static void raid_presuspend(struct dm_target *ti)

drivers/md/dm-stripe.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,15 @@ static void stripe_io_hints(struct dm_target *ti,
456456
struct queue_limits *limits)
457457
{
458458
struct stripe_c *sc = ti->private;
459-
unsigned int chunk_size = sc->chunk_size << SECTOR_SHIFT;
459+
unsigned int io_min, io_opt;
460460

461461
limits->chunk_sectors = sc->chunk_size;
462-
limits->io_min = chunk_size;
463-
limits->io_opt = chunk_size * sc->stripes;
462+
463+
if (!check_shl_overflow(sc->chunk_size, SECTOR_SHIFT, &io_min) &&
464+
!check_mul_overflow(io_min, sc->stripes, &io_opt)) {
465+
limits->io_min = io_min;
466+
limits->io_opt = io_opt;
467+
}
464468
}
465469

466470
static struct target_type stripe_target = {

0 commit comments

Comments
 (0)