Skip to content

Commit

Permalink
md/raid10: fix wrong setting of max_corr_read_errors
Browse files Browse the repository at this point in the history
There is no input check when echo md/max_read_errors and overflow might
occur. Add check of input number.

Fixes: 1e50915 ("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
  • Loading branch information
Li Nan authored and liu-song-6 committed Jun 13, 2023
1 parent 6beb489 commit f8b20a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f8b20a4

Please sign in to comment.