Skip to content

Commit 7928a42

Browse files
committed
Merge: dm: Add missing commits and v6.8 bugfixes from upstream
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4146 JIRA: https://issues.redhat.com/browse/RHEL-34599 JIRA: https://issues.redhat.com/browse/RHEL-33217 CVE: CVE-2024-26880 Tested: lvm2-testsuite, cryptsetup tests, and the CVE reproducer Upstream Status: kernel/git/torvalds/linux.git Pull in various dm changes along with a block dependency. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Approved-by: Ming Lei <ming.lei@redhat.com> Approved-by: Mikuláš Patočka <mpatocka@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 16a846d + 30c7fab commit 7928a42

File tree

13 files changed

+123
-40
lines changed

13 files changed

+123
-40
lines changed

block/blk-core.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -982,16 +982,11 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end)
982982
}
983983
}
984984

985-
unsigned long bdev_start_io_acct(struct block_device *bdev,
986-
unsigned int sectors, enum req_op op,
985+
unsigned long bdev_start_io_acct(struct block_device *bdev, enum req_op op,
987986
unsigned long start_time)
988987
{
989-
const int sgrp = op_stat_group(op);
990-
991988
part_stat_lock();
992989
update_io_ticks(bdev, start_time, false);
993-
part_stat_inc(bdev, ios[sgrp]);
994-
part_stat_add(bdev, sectors[sgrp], sectors);
995990
part_stat_local_inc(bdev, in_flight[op_is_write(op)]);
996991
part_stat_unlock();
997992

@@ -1007,20 +1002,21 @@ EXPORT_SYMBOL(bdev_start_io_acct);
10071002
*/
10081003
unsigned long bio_start_io_acct(struct bio *bio)
10091004
{
1010-
return bdev_start_io_acct(bio->bi_bdev, bio_sectors(bio),
1011-
bio_op(bio), jiffies);
1005+
return bdev_start_io_acct(bio->bi_bdev, bio_op(bio), jiffies);
10121006
}
10131007
EXPORT_SYMBOL_GPL(bio_start_io_acct);
10141008

10151009
void bdev_end_io_acct(struct block_device *bdev, enum req_op op,
1016-
unsigned long start_time)
1010+
unsigned int sectors, unsigned long start_time)
10171011
{
10181012
const int sgrp = op_stat_group(op);
10191013
unsigned long now = READ_ONCE(jiffies);
10201014
unsigned long duration = now - start_time;
10211015

10221016
part_stat_lock();
10231017
update_io_ticks(bdev, now, true);
1018+
part_stat_inc(bdev, ios[sgrp]);
1019+
part_stat_add(bdev, sectors[sgrp], sectors);
10241020
part_stat_add(bdev, nsecs[sgrp], jiffies_to_nsecs(duration));
10251021
part_stat_local_dec(bdev, in_flight[op_is_write(op)]);
10261022
part_stat_unlock();
@@ -1030,7 +1026,7 @@ EXPORT_SYMBOL(bdev_end_io_acct);
10301026
void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time,
10311027
struct block_device *orig_bdev)
10321028
{
1033-
bdev_end_io_acct(orig_bdev, bio_op(bio), start_time);
1029+
bdev_end_io_acct(orig_bdev, bio_op(bio), bio_sectors(bio), start_time);
10341030
}
10351031
EXPORT_SYMBOL_GPL(bio_end_io_acct_remapped);
10361032

drivers/md/dm-bio-prison-v1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct prison_region {
2626
struct dm_bio_prison {
2727
mempool_t cell_pool;
2828
unsigned int num_locks;
29-
struct prison_region regions[];
29+
struct prison_region regions[] __counted_by(num_locks);
3030
};
3131

3232
static struct kmem_cache *_cell_cache;

drivers/md/dm-crypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ struct crypt_config {
226226
struct mutex bio_alloc_lock;
227227

228228
u8 *authenc_key; /* space for keys in authenc() format (if used) */
229-
u8 key[];
229+
u8 key[] __counted_by(key_size);
230230
};
231231

232232
#define MIN_IOS 64

drivers/md/dm-flakey.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static void corrupt_bio_random(struct bio *bio)
384384
return;
385385

386386
corrupt_byte = get_random_u32() % bio->bi_iter.bi_size;
387-
corrupt_value = get_random_u32() & 0xff;
387+
corrupt_value = get_random_u8();
388388

389389
corrupt_bio_common(bio, corrupt_byte, corrupt_value);
390390
}

drivers/md/dm-integrity.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,7 +4221,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
42214221
} else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) {
42224222
log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval);
42234223
} else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) {
4224-
if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
4224+
if ((uint64_t)val >= (uint64_t)UINT_MAX * 1000 / HZ) {
42254225
r = -EINVAL;
42264226
ti->error = "Invalid bitmap_flush_interval argument";
42274227
goto bad;
@@ -4350,10 +4350,10 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
43504350
}
43514351

43524352
/*
4353-
* If this workqueue were percpu, it would cause bio reordering
4353+
* If this workqueue weren't ordered, it would cause bio reordering
43544354
* and reduced performance.
43554355
*/
4356-
ic->wait_wq = alloc_workqueue("dm-integrity-wait", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
4356+
ic->wait_wq = alloc_ordered_workqueue("dm-integrity-wait", WQ_MEM_RECLAIM);
43574357
if (!ic->wait_wq) {
43584358
ti->error = "Cannot allocate workqueue";
43594359
r = -ENOMEM;

drivers/md/dm-raid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ struct raid_set {
255255
int mode;
256256
} journal_dev;
257257

258-
struct raid_dev dev[];
258+
struct raid_dev dev[] __counted_by(raid_disks);
259259
};
260260

261261
static void rs_config_backup(struct raid_set *rs, struct rs_layout *l)
@@ -3331,14 +3331,14 @@ static int raid_map(struct dm_target *ti, struct bio *bio)
33313331
struct mddev *mddev = &rs->md;
33323332

33333333
/*
3334-
* If we're reshaping to add disk(s)), ti->len and
3334+
* If we're reshaping to add disk(s), ti->len and
33353335
* mddev->array_sectors will differ during the process
33363336
* (ti->len > mddev->array_sectors), so we have to requeue
33373337
* bios with addresses > mddev->array_sectors here or
33383338
* there will occur accesses past EOD of the component
33393339
* data images thus erroring the raid set.
33403340
*/
3341-
if (unlikely(bio_end_sector(bio) > mddev->array_sectors))
3341+
if (unlikely(bio_has_data(bio) && bio_end_sector(bio) > mddev->array_sectors))
33423342
return DM_MAPIO_REQUEUE;
33433343

33443344
if (unlikely(!md_handle_request(mddev, bio)))

drivers/md/dm-snap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,10 @@ static void dm_exception_table_exit(struct dm_exception_table *et,
684684
for (i = 0; i < size; i++) {
685685
slot = et->table + i;
686686

687-
hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list)
687+
hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) {
688688
kmem_cache_free(mem, ex);
689+
cond_resched();
690+
}
689691
}
690692

691693
kvfree(et->table);

drivers/md/dm-stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct dm_stat {
5656
size_t percpu_alloc_size;
5757
size_t histogram_alloc_size;
5858
struct dm_stat_percpu *stat_percpu[NR_CPUS];
59-
struct dm_stat_shared stat_shared[];
59+
struct dm_stat_shared stat_shared[] __counted_by(n_entries);
6060
};
6161

6262
#define STAT_PRECISE_TIMESTAMPS 1

drivers/md/dm-stripe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct stripe_c {
4444
/* Work struct used for triggering events*/
4545
struct work_struct trigger_event;
4646

47-
struct stripe stripe[];
47+
struct stripe stripe[] __counted_by(stripes);
4848
};
4949

5050
/*

drivers/md/dm-verity-loadpin.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ bool dm_verity_loadpin_is_bdev_trusted(struct block_device *bdev)
5858
int srcu_idx;
5959
bool trusted = false;
6060

61+
if (bdev == NULL)
62+
return false;
63+
6164
if (list_empty(&dm_verity_loadpin_trusted_root_digests))
6265
return false;
6366

0 commit comments

Comments
 (0)