linux-stable/drivers/md
Mikulas Patocka cb2b974ad5 dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata()
commit b86f4b790c upstream.

__bio_for_each_segment assumes that the first struct bio_vec argument
doesn't change - it calls "bio_advance_iter_single((bio), &(iter),
(bvl).bv_len)" to advance the iterator. Unfortunately, the dm-integrity
code changes the bio_vec with "bv.bv_len -= pos". When this code path
is taken, the iterator would be out of sync and dm-integrity would
report errors. This happens if the machine is out of memory and
"kmalloc" fails.

Fix this bug by making a copy of "bv" and changing the copy instead.

Fixes: 7eada909bf ("dm: add integrity target")
Cc: stable@vger.kernel.org	# v4.12+
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-08 11:25:04 +01:00
..
bcache bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc() 2023-12-20 15:32:35 +01:00
persistent-data dm space map common: add bounds check to sm_ll_lookup_bitmap() 2022-01-27 09:00:57 +01:00
Kconfig
Makefile
bitmap.c md/bitmap: md_bitmap_get_counter returns wrong blocks 2020-11-05 11:06:56 +01:00
bitmap.h md: Avoid namespace collision with bitmap API 2020-01-29 15:02:39 +01:00
dm-bio-prison-v1.c dm: Use kzalloc for all structs with embedded biosets/mempools 2019-11-06 12:42:52 +01:00
dm-bio-prison-v1.h
dm-bio-prison-v2.c dm: Use kzalloc for all structs with embedded biosets/mempools 2019-11-06 12:42:52 +01:00
dm-bio-prison-v2.h
dm-bio-record.h dm bio record: save/restore bi_end_io and bi_integrity 2020-04-02 16:34:14 +02:00
dm-bufio.c Revert "dm bufio: fix deadlock with loop device" 2019-08-29 08:26:42 +02:00
dm-bufio.h
dm-builtin.c
dm-cache-background-tracker.c
dm-cache-background-tracker.h
dm-cache-block-types.h
dm-cache-metadata.c dm cache: Fix ABBA deadlock between shrink_slab and dm_cache_metadata_abort 2023-01-18 09:26:36 +01:00
dm-cache-metadata.h
dm-cache-policy-internal.h
dm-cache-policy-smq.c dm cache policy smq: ensure IO doesn't prevent cleaner policy progress 2023-08-11 11:33:53 +02:00
dm-cache-policy.c
dm-cache-policy.h
dm-cache-target.c dm cache: add cond_resched() to various workqueue loops 2023-03-11 16:26:43 +01:00
dm-core.h
dm-crypt.c dm crypt: add cond_resched() to dmcrypt_write() 2023-04-05 11:14:18 +02:00
dm-delay.c dm delay: fix a crash when invalid device is specified 2019-05-25 18:25:33 +02:00
dm-era-target.c dm era: commit metadata in postsuspend after worker stops 2022-07-02 16:18:08 +02:00
dm-exception-store.c
dm-exception-store.h
dm-flakey.c dm flakey: fix a crash with invalid table line 2023-05-17 11:11:47 +02:00
dm-integrity.c dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata() 2024-01-08 11:25:04 +01:00
dm-io.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
dm-ioctl.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
dm-kcopyd.c dm: Use kzalloc for all structs with embedded biosets/mempools 2019-11-06 12:42:52 +01:00
dm-linear.c
dm-log-userspace-base.c
dm-log-userspace-transfer.c
dm-log-userspace-transfer.h
dm-log-writes.c dm log writes: make sure super sector log updates are written in order 2019-07-03 13:16:00 +02:00
dm-log.c
dm-mpath.c dm mpath: switch paths in dm_blk_ioctl() code path 2020-06-25 15:41:48 +02:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid.c dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths 2023-08-11 11:33:51 +02:00
dm-raid1.c
dm-region-hash.c dm: Use kzalloc for all structs with embedded biosets/mempools 2019-11-06 12:42:52 +01:00
dm-round-robin.c
dm-rq.c dm rq: fix double free of blk_mq_tag_set in dev remove after table load fails 2021-05-22 10:57:23 +02:00
dm-rq.h
dm-service-time.c
dm-snap-persistent.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
dm-snap-transient.c
dm-snap.c dm snapshot: properly fix a crash when an origin has no snapshots 2021-06-03 08:36:15 +02:00
dm-stats.c dm stats: check for and propagate alloc_percpu failure 2023-04-05 11:14:18 +02:00
dm-stats.h dm stats: check for and propagate alloc_percpu failure 2023-04-05 11:14:18 +02:00
dm-stripe.c
dm-switch.c
dm-sysfs.c
dm-table.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
dm-target.c
dm-thin-metadata.c dm thin: Use last transaction's pmd->root when commit failed 2023-01-18 09:26:37 +01:00
dm-thin-metadata.h dm thin: fix passdown_double_checking_shared_status() 2019-01-31 08:13:45 +01:00
dm-thin.c dm thin: add cond_resched() to various workqueue loops 2023-03-11 16:26:43 +01:00
dm-uevent.c
dm-uevent.h
dm-verity-fec.c dm-verity: align struct dm_verity_fec_io properly 2023-12-08 08:42:00 +01:00
dm-verity-fec.h
dm-verity-target.c dm verity: don't perform FEC for failed readahead IO 2023-12-08 08:42:00 +01:00
dm-verity.h dm-verity: align struct dm_verity_fec_io properly 2023-12-08 08:42:00 +01:00
dm-zero.c
dm-zoned-metadata.c dm zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone 2020-06-25 15:41:54 +02:00
dm-zoned-reclaim.c dm zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone 2020-06-25 15:41:54 +02:00
dm-zoned-target.c dm zoned: assign max_io_len correctly 2020-07-09 09:36:33 +02:00
dm-zoned.h dm zoned: reduce overhead of backing device checks 2019-12-17 20:39:25 +01:00
dm.c dm stats: check for and propagate alloc_percpu failure 2023-04-05 11:14:18 +02:00
dm.h
faulty.c
linear.c
linear.h
md-cluster.c md/cluster: fix deadlock when node is doing resync job 2020-12-29 13:47:10 +01:00
md-cluster.h
md.c md: fix data corruption for raid456 when reshape restart while grow up 2023-08-11 11:33:48 +02:00
md.h md: don't report active array_state until after revalidate_disk() completes. 2019-10-05 12:48:10 +02:00
multipath.c
multipath.h
raid0.c md/raid0: add discard support for the 'original' layout 2023-08-11 11:33:45 +02:00
raid0.h md/raid0: add discard support for the 'original' layout 2023-08-11 11:33:45 +02:00
raid1-10.c
raid1.c md/raid1: fix error: ISO C90 forbids mixed declarations 2023-09-23 10:47:05 +02:00
raid1.h
raid5-cache.c md/raid5: fix 'out of memory' during raid cache recovery 2019-02-06 17:31:37 +01:00
raid5-log.h
raid5-ppl.c
raid5.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
raid5.h
raid10.c md/raid10: prevent soft lockup while flush writes 2023-08-11 11:33:48 +02:00
raid10.h