summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorLi Nan <linan122@huawei.com>2023-05-22 09:25:34 +0200
committerSong Liu <song@kernel.org>2023-06-14 00:13:22 +0200
commitf8b20a405428803bd9881881d8242c9d72c6b2b2 (patch)
tree37510d78af1867c1914d69411cfd8a77fb11e308 /drivers/md
parentmd/raid10: fix overflow of md/safe_mode_delay (diff)
downloadlinux-f8b20a405428803bd9881881d8242c9d72c6b2b2.tar.xz
linux-f8b20a405428803bd9881881d8242c9d72c6b2b2.zip
md/raid10: fix wrong setting of max_corr_read_errors
There is no input check when echo md/max_read_errors and overflow might occur. Add check of input number. Fixes: 1e50915fe0bb ("raid: improve MD/raid10 handling of correctable read errors.") Signed-off-by: Li Nan <linan122@huawei.com> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230522072535.1523740-3-linan666@huaweicloud.com
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2fc8d25f6e80..49c83ed08937 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4468,6 +4468,8 @@ max_corrected_read_errors_store(struct mddev *mddev, const char *buf, size_t len
rv = kstrtouint(buf, 10, &n);
if (rv < 0)
return rv;
+ if (n > INT_MAX)
+ return -EINVAL;
atomic_set(&mddev->max_corr_read_errors, n);
return len;
}