linux/drivers/md
Coly Li b407539849 bcache: avoid nr_stripes overflow in bcache_device_init()
[ Upstream commit 65f0f017e7 ]

For some block devices which large capacity (e.g. 8TB) but small io_opt
size (e.g. 8 sectors), in bcache_device_init() the stripes number calcu-
lated by,
	DIV_ROUND_UP_ULL(sectors, d->stripe_size);
might be overflow to the unsigned int bcache_device->nr_stripes.

This patch uses the uint64_t variable to store DIV_ROUND_UP_ULL()
and after the value is checked to be available in unsigned int range,
sets it to bache_device->nr_stripes. Then the overflow is avoided.

Reported-and-tested-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Coly Li <colyli@suse.de>
Cc: stable@vger.kernel.org
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783075
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-26 10:40:48 +02:00
..
bcache bcache: avoid nr_stripes overflow in bcache_device_init() 2020-08-26 10:40:48 +02:00
persistent-data
Kconfig
Makefile
dm-bio-prison-v1.c
dm-bio-prison-v1.h
dm-bio-prison-v2.c
dm-bio-prison-v2.h
dm-bio-record.h
dm-bufio.c
dm-builtin.c
dm-cache-background-tracker.c
dm-cache-background-tracker.h
dm-cache-block-types.h
dm-cache-metadata.c
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-clone-metadata.c dm clone: Fix handling of partial region discards 2020-04-17 10:50:24 +02:00
dm-clone-metadata.h dm clone: replace spin_lock_irqsave with spin_lock_irq 2020-04-17 10:50:23 +02:00
dm-clone-target.c dm clone: Add missing casts to prevent overflows and data corruption 2020-04-17 10:50:24 +02:00
dm-core.h
dm-crypt.c dm crypt: avoid truncating the logical block size 2020-06-22 09:31:21 +02:00
dm-delay.c
dm-dust.c
dm-era-target.c
dm-exception-store.c
dm-exception-store.h
dm-flakey.c
dm-init.c
dm-integrity.c dm integrity: fix integrity recalculation that is improperly skipped 2020-07-29 10:18:45 +02:00
dm-io.c
dm-ioctl.c
dm-kcopyd.c
dm-linear.c
dm-log-userspace-base.c
dm-log-userspace-transfer.c
dm-log-userspace-transfer.h
dm-log-writes.c
dm-log.c
dm-mpath.c dm mpath: switch paths in dm_blk_ioctl() code path 2020-06-24 17:50:13 +02:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid.c
dm-raid1.c
dm-region-hash.c
dm-round-robin.c
dm-rq.c dm rq: don't call blk_mq_queue_stopped() in dm_stop_queue() 2020-08-21 13:05:33 +02:00
dm-rq.h
dm-service-time.c
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c
dm-stats.c
dm-stats.h
dm-stripe.c
dm-switch.c
dm-sysfs.c
dm-table.c
dm-target.c
dm-thin-metadata.c
dm-thin-metadata.h
dm-thin.c
dm-uevent.c
dm-uevent.h
dm-unstripe.c
dm-verity-fec.c dm verity fec: fix hash block number in verity_fec_decode 2020-05-06 08:15:10 +02:00
dm-verity-fec.h
dm-verity-target.c
dm-verity-verify-sig.c
dm-verity-verify-sig.h
dm-verity.h
dm-writecache.c dm writecache: reject asynchronous pmem devices 2020-07-16 08:16:47 +02: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-24 17:50:31 +02:00
dm-zoned-reclaim.c dm zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone 2020-06-24 17:50:31 +02:00
dm-zoned-target.c dm zoned: assign max_io_len correctly 2020-07-09 09:37:57 +02:00
dm-zoned.h
dm.c dm integrity: fix integrity recalculation that is improperly skipped 2020-07-29 10:18:45 +02:00
dm.h
md-bitmap.c
md-bitmap.h
md-cluster.c md-cluster: Fix potential error pointer dereference in resize_bitmaps() 2020-08-21 13:05:36 +02:00
md-cluster.h
md-faulty.c
md-linear.c
md-linear.h
md-multipath.c
md-multipath.h
md.c md: raid0/linear: fix dereference before null check on pointer mddev 2020-08-19 08:15:58 +02:00
md.h
raid0.c
raid0.h
raid1-10.c
raid1.c
raid1.h
raid5-cache.c
raid5-log.h
raid5-ppl.c
raid5.c md/raid5: Fix Force reconstruct-write io stuck in degraded raid5 2020-08-21 13:05:25 +02:00
raid5.h
raid10.c
raid10.h