Li Nan
9e8bf9f95f
blk-iocost: fix divide by 0 error in calc_lcoefs()
...
[ Upstream commit 984af1e66b4126cf145153661cc24c213e2ec231 ]
echo max of u64 to cost.model can cause divide by 0 error.
# echo 8:0 rbps=18446744073709551615 > /sys/fs/cgroup/io.cost.model
divide error: 0000 [#1 ] PREEMPT SMP
RIP: 0010:calc_lcoefs+0x4c/0xc0
Call Trace:
<TASK>
ioc_refresh_params+0x2b3/0x4f0
ioc_cost_model_write+0x3cb/0x4c0
? _copy_from_iter+0x6d/0x6c0
? kernfs_fop_write_iter+0xfc/0x270
cgroup_file_write+0xa0/0x200
kernfs_fop_write_iter+0x17d/0x270
vfs_write+0x414/0x620
ksys_write+0x73/0x160
__x64_sys_write+0x1e/0x30
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
calc_lcoefs() uses the input value of cost.model in DIV_ROUND_UP_ULL,
overflow would happen if bps plus IOC_PAGE_SIZE is greater than
ULLONG_MAX, it can cause divide by 0 error.
Fix the problem by setting basecost
Signed-off-by: Li Nan <linan122@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230117070806.3857142-5-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-11 16:43:54 +01:00
..
partitions
badblocks.c
bfq-cgroup.c
block, bfq: fix null pointer dereference in bfq_bio_bfqg()
2022-12-08 11:22:57 +01:00
bfq-iosched.c
block, bfq: protect 'bfqd->queued' by 'bfqd->lock'
2022-11-10 17:57:54 +01:00
bfq-iosched.h
bfq: Get rid of __bio_blkcg() usage
2022-06-14 18:11:50 +02:00
bfq-wf2q.c
bio-integrity.c
block: bio-integrity: Copy flags when bio_integrity_payload is cloned
2023-03-11 16:43:35 +01:00
bio.c
block: fix bio_clone_blkg_association() to associate with proper blkcg_gq
2022-06-14 18:11:50 +02:00
blk-cgroup.c
blk-cgroup: fix missing pd_online_fn() while activating policy
2023-02-06 07:52:48 +01:00
blk-core.c
block: fix and cleanup bio_check_ro
2023-02-06 07:52:47 +01:00
blk-exec.c
blk-flush.c
block: Fix fsync always failed if once failed
2022-03-08 19:07:47 +01:00
blk-integrity.c
blk-ioc.c
blk-iocost.c
blk-iocost: fix divide by 0 error in calc_lcoefs()
2023-03-11 16:43:54 +01:00
blk-iolatency.c
blk-iolatency: Fix inflight count imbalances and IO hangs on offline
2022-06-14 18:11:49 +02:00
blk-lib.c
blk-map.c
blk-merge.c
block: return ELEVATOR_DISCARD_MERGE if possible
2022-05-25 09:14:38 +02:00
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created
2022-08-25 11:17:36 +02:00
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c
blk-mq: correct stale comment of .get_budget
2023-03-11 16:43:34 +01:00
blk-mq-sched.h
blk-mq-sysfs.c
blk-mq: fix possible memleak when register 'hctx' failed
2023-01-18 11:41:38 +01:00
blk-mq-tag.c
blk-mq-tag.h
blk-mq-virtio.c
blk-mq.c
blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait
2023-03-11 16:43:34 +01:00
blk-mq.h
blk-pm.c
scsi: block: Fix a race in the runtime power management code
2021-01-06 14:48:37 +01:00
blk-pm.h
blk-rq-qos.c
rq-qos: fix missed wake-ups in rq_qos_throttle try two
2021-07-19 08:53:16 +02:00
blk-rq-qos.h
block: fix race between adding/removing rq qos and normal IO
2021-07-14 16:53:18 +02:00
blk-settings.c
blk-settings: align max_sectors on "logical_block_size" boundary
2021-03-04 10:26:40 +01:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c
block: don't delete queue kobject before its children
2022-04-15 14:18:05 +02:00
blk-throttle.c
blk-throttle: fix UAF by deleteing timer in blk_throtl_exit()
2021-09-26 14:07:13 +02:00
blk-timeout.c
blk-wbt.c
blk-wbt: make sure throttle is enabled properly
2021-07-14 16:53:25 +02:00
blk-wbt.h
blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()
2021-07-14 16:53:25 +02:00
blk-zoned.c
blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN
2021-09-22 12:26:19 +02:00
blk.h
bounce.c
bsg-lib.c
bsg.c
scsi: bsg: Remove support for SCSI_IOCTL_SEND_COMMAND
2021-09-22 12:26:23 +02:00
cmdline-parser.c
compat_ioctl.c
block/compat_ioctl: fix range check in BLKGETSIZE
2022-04-27 13:50:50 +02:00
elevator.c
block: return ELEVATOR_DISCARD_MERGE if possible
2022-05-25 09:14:38 +02:00
genhd.c
block: Suppress uevent for hidden device when removed
2021-03-30 14:35:23 +02:00
ioctl.c
ioprio.c
block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2)
2021-12-14 14:49:02 +01:00
Kconfig
Kconfig.iosched
kyber-iosched.c
kyber: fix out of bounds access when preempted
2021-05-19 10:08:30 +02:00
Makefile
mq-deadline.c
block: return ELEVATOR_DISCARD_MERGE if possible
2022-05-25 09:14:38 +02:00
opal_proto.h
partition-generic.c
block: unhash blkdev part inode when the part is deleted
2022-12-19 12:24:16 +01:00
scsi_ioctl.c
sed-opal.c
block: sed-opal: kmalloc the cmd/resp buffers
2022-11-25 17:42:14 +01:00
t10-pi.c