diff options
author | Coly Li | 2019-02-09 05:53:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-04-05 22:33:17 +0200 |
commit | e7d26616c92bd96364b45c532b39e455523abb5f (patch) | |
tree | 4a79cf897b585a272004b565dbbba6a10b86ea1c /security/selinux/.gitignore | |
parent | ACPI / video: Extend chassis-type detection with a "Lunch Box" check (diff) | |
download | kernel-qcow2-linux-e7d26616c92bd96364b45c532b39e455523abb5f.tar.gz kernel-qcow2-linux-e7d26616c92bd96364b45c532b39e455523abb5f.tar.xz kernel-qcow2-linux-e7d26616c92bd96364b45c532b39e455523abb5f.zip |
bcache: fix potential div-zero error of writeback_rate_p_term_inverse
[ Upstream commit 5b5fd3c94eef69dcfaa8648198e54c92e5687d6d ]
Current code already uses d_strtoul_nonzero() to convert input string
to an unsigned integer, to make sure writeback_rate_p_term_inverse
won't be zero value. But overflow may happen when converting input
string to an unsigned integer value by d_strtoul_nonzero(), then
dc->writeback_rate_p_term_inverse can still be set to 0 even if the
sysfs file input value is not zero, e.g. 4294967296 (a.k.a UINT_MAX+1).
If dc->writeback_rate_p_term_inverse is set to 0, it might cause a
dev-zero error in following code from __update_writeback_rate(),
int64_t proportional_scaled =
div_s64(error, dc->writeback_rate_p_term_inverse);
This patch replaces d_strtoul_nonzero() by sysfs_strtoul_clamp() and
limit the value range in [1, UINT_MAX]. Then the unsigned integer
overflow and dev-zero error can be avoided.
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security/selinux/.gitignore')
0 files changed, 0 insertions, 0 deletions