From: Chao Yu Date: Fri, 23 Jun 2017 05:08:22 +0000 (-0400) Subject: ext4: check return value of kstrtoull correctly in reserved_clusters_store X-Git-Tag: v4.11.11~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f7921d8de1ce28f3dd2250dc05e57c0fcbf6f21;p=thirdparty%2Fkernel%2Fstable.git ext4: check return value of kstrtoull correctly in reserved_clusters_store commit 1ea1516fbbab2b30bf98c534ecaacba579a35208 upstream. 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 Signed-off-by: Chao Yu Signed-off-by: Miao Xie Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index 42145be5c6b4d..5dc655e410b4f 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -100,7 +100,7 @@ static ssize_t reserved_clusters_store(struct ext4_attr *a, int ret; ret = kstrtoull(skip_spaces(buf), 0, &val); - if (!ret || val >= clusters) + if (ret || val >= clusters) return -EINVAL; atomic64_set(&sbi->s_resv_clusters, val);