linux-stable/drivers/md
NeilBrown ca39e8187f md/raid0: avoid RAID0 data corruption due to layout confusion.
[ Upstream commit c84a1372df ]

If the drives in a RAID0 are not all the same size, the array is
divided into zones.
The first zone covers all drives, to the size of the smallest.
The second zone covers all drives larger than the smallest, up to
the size of the second smallest - etc.

A change in Linux 3.14 unintentionally changed the layout for the
second and subsequent zones.  All the correct data is still stored, but
each chunk may be assigned to a different device than in pre-3.14 kernels.
This can lead to data corruption.

It is not possible to determine what layout to use - it depends which
kernel the data was written by.
So we add a module parameter to allow the old (0) or new (1) layout to be
specified, and refused to assemble an affected array if that parameter is
not set.

Fixes: 20d0189b10 ("block: Introduce new bio_split()")
cc: stable@vger.kernel.org (3.14+)
Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-10-05 12:48:13 +02:00
..
bcache bcache: check c->gc_thread by IS_ERR_OR_NULL in cache_set_flush() 2019-07-31 07:28:31 +02:00
persistent-data dm space map metadata: fix missing store of apply_bops() return value 2019-08-29 08:26:44 +02:00
bitmap.c md: free unused memory after bitmap resize 2017-12-17 15:08:00 +01:00
bitmap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dm-bio-prison-v1.c
dm-bio-prison-v1.h
dm-bio-prison-v2.c
dm-bio-prison-v2.h
dm-bio-record.h block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
dm-bufio.c Revert "dm bufio: fix deadlock with loop device" 2019-08-29 08:26:42 +02:00
dm-bufio.h dm integrity: optimize writing dm-bufio buffers that are partially changed 2017-08-28 11:47:17 -04:00
dm-builtin.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dm-cache-background-tracker.c
dm-cache-background-tracker.h
dm-cache-block-types.h
dm-cache-metadata.c dm cache metadata: Fix loading discard bitset 2019-05-25 18:25:32 +02:00
dm-cache-metadata.h
dm-cache-policy-internal.h
dm-cache-policy-smq.c
dm-cache-policy.c
dm-cache-policy.h
dm-cache-target.c dm cache: destroy migration_cache if cache target registration failed 2018-10-18 09:16:24 +02:00
dm-core.h dm: allocate struct mapped_device with kvzalloc 2017-11-30 08:40:43 +00:00
dm-crypt.c dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock 2019-04-20 09:15:08 +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 block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
dm-exception-store.c
dm-exception-store.h
dm-flakey.c dm linear: fix linear_end_io conditional definition 2018-10-18 09:16:24 +02:00
dm-integrity.c dm integrity: change memcmp to strncmp in dm_integrity_ctr 2019-05-02 09:40:32 +02:00
dm-io.c block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
dm-ioctl.c dm ioctl: harden copy_params()'s copy_from_user() from malicious users 2018-11-13 11:15:10 -08:00
dm-kcopyd.c dm kcopyd: always complete failed jobs 2019-08-29 08:26:44 +02:00
dm-linear.c dm linear: fix linear_end_io conditional definition 2018-10-18 09:16:24 +02:00
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: return DM_MAPIO_REQUEUE on blk-mq rq allocation failure 2018-04-26 11:02:07 +02:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid.c dm raid: fix rebuild of specific devices by updating superblock 2018-10-10 08:54:24 +02:00
dm-raid1.c block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
dm-region-hash.c
dm-round-robin.c
dm-rq.c dm rq: do not update rq partially in each ending bio 2017-08-28 10:23:28 -04:00
dm-rq.h dm rq: do not update rq partially in each ending bio 2017-08-28 10:23:28 -04:00
dm-service-time.c
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c dm snapshot: Fix excessive memory usage and workqueue stalls 2019-01-26 09:37:05 +01:00
dm-stats.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dm-stats.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dm-stripe.c - Some request-based DM core and DM multipath fixes and cleanups 2017-09-14 13:43:16 -07:00
dm-switch.c - Some request-based DM core and DM multipath fixes and cleanups 2017-09-14 13:43:16 -07:00
dm-sysfs.c
dm-table.c dm table: fix invalid memory accesses with too high sector number 2019-08-29 08:26:44 +02:00
dm-target.c
dm-thin-metadata.c dm thin: fix passdown_double_checking_shared_status() 2019-01-31 08:13:45 +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 sanity checks to thin-pool and external snapshot creation 2019-04-05 22:31:28 +02:00
dm-uevent.c
dm-uevent.h
dm-verity-fec.c dm verity fec: fix GFP flags used with mempool_alloc() 2017-07-26 15:55:44 -04:00
dm-verity-fec.h
dm-verity-target.c dm verity: use message limit for data block corruption message 2019-07-21 09:04:40 +02:00
dm-verity.h
dm-zero.c
dm-zoned-metadata.c dm zoned: fix potential NULL dereference in dmz_do_reclaim() 2019-08-29 08:26:45 +02:00
dm-zoned-reclaim.c dm zoned: properly handle backing device failure 2019-08-29 08:26:44 +02:00
dm-zoned-target.c dm zoned: fix invalid memory access 2019-10-05 12:47:37 +02:00
dm-zoned.h dm zoned: properly handle backing device failure 2019-08-29 08:26:44 +02:00
dm.c dm: fix report zone remapping to account for partition offset 2018-10-18 09:16:24 +02:00
dm.h
faulty.c block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
Kconfig
linear.c block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
linear.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
md-cluster.c md-cluster: clear another node's suspend_area after the copy is finished 2018-10-03 17:00:47 -07:00
md-cluster.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
md.c md: only call set_in_sync() when it is expected to succeed. 2019-10-05 12:48:10 +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 block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
multipath.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
raid0.c md/raid0: avoid RAID0 data corruption due to layout confusion. 2019-10-05 12:48:13 +02:00
raid0.h md/raid0: avoid RAID0 data corruption due to layout confusion. 2019-10-05 12:48:13 +02:00
raid1-10.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
raid1.c md/raid1: fail run raid1 array when active disk less than one 2019-10-05 12:48:00 +02:00
raid1.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
raid5-cache.c md/raid5: fix 'out of memory' during raid cache recovery 2019-02-06 17:31:37 +01:00
raid5-log.h md/raid5-cache: disable reshape completely 2018-10-10 08:54:20 +02:00
raid5-ppl.c raid5-ppl: check recovery_offset when performing ppl recovery 2017-12-20 10:10:36 +01:00
raid5.c md/raid6: Set R5_ReadError when there is read failure on parity disk 2019-10-05 12:48:10 +02:00
raid5.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
raid10.c md: Fix failed allocation of md_register_thread 2019-03-23 14:35:30 +01:00
raid10.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00