mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
btrfs: sysfs: validate scrub_speed_max value
commit 2b0122aaa8 upstream.
The value set as scrub_speed_max accepts size with suffixes
(k/m/g/t/p/e) but we should still validate it for trailing characters,
similar to what we do with chunk_size_store.
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3da8706499
commit
5e570e600b
|
|
@ -1760,6 +1760,10 @@ static ssize_t btrfs_devinfo_scrub_speed_max_store(struct kobject *kobj,
|
|||
unsigned long long limit;
|
||||
|
||||
limit = memparse(buf, &endptr);
|
||||
/* There could be trailing '\n', also catch any typos after the value. */
|
||||
endptr = skip_spaces(endptr);
|
||||
if (*endptr != 0)
|
||||
return -EINVAL;
|
||||
WRITE_ONCE(device->scrub_speed_max, limit);
|
||||
return len;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user