Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ext4: check return value of kstrtoull correctly in reserved_clusters_store

kstrtoull returns 0 on success, however, in reserved_clusters_store we
will return -EINVAL if kstrtoull returns 0, it makes us fail to update
reserved_clusters value through sysfs.

Fixes: 76d33bca5581b1dd5c3157fa168db849a784ada4
Cc: stable@vger.kernel.org # 4.4
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Miao Xie <miaoxie@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Chao Yu and committed by
Theodore Ts'o
1ea1516f 4a495624

+1 -1
+1 -1
fs/ext4/sysfs.c
··· 100 100 int ret; 101 101 102 102 ret = kstrtoull(skip_spaces(buf), 0, &val); 103 - if (!ret || val >= clusters) 103 + if (ret || val >= clusters) 104 104 return -EINVAL; 105 105 106 106 atomic64_set(&sbi->s_resv_clusters, val);