Skip to content

Commit f8b20a4

Browse files
Li Nanliu-song-6
authored andcommitted
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: 1e50915 ("raid: improve MD/raid10 handling of correctable read errors.") Signed-off-by: Li Nan <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6beb489 commit f8b20a4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/md.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4468,6 +4468,8 @@ max_corrected_read_errors_store(struct mddev *mddev, const char *buf, size_t len
44684468
rv = kstrtouint(buf, 10, &n);
44694469
if (rv < 0)
44704470
return rv;
4471+
if (n > INT_MAX)
4472+
return -EINVAL;
44714473
atomic_set(&mddev->max_corr_read_errors, n);
44724474
return len;
44734475
}

0 commit comments

Comments
 (0)