* [PATCH] ext4: fix reserved_clusters_store()
@ 2017-06-23 9:28 Dan Carpenter
2017-06-23 12:14 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-06-23 9:28 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Andreas Dilger, linux-ext4, kernel-janitors
The test if kstrtoull() failed is reversed so we can't set cluster_store
any more.
Fixes: 76d33bca5581 ("ext4: refactor sysfs support code")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index d74dc5f81a04..5d543523f479 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -100,7 +100,9 @@ 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)
+ return ret;
+ if (val >= clusters)
return -EINVAL;
atomic64_set(&sbi->s_resv_clusters, val);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ext4: fix reserved_clusters_store()
2017-06-23 9:28 [PATCH] ext4: fix reserved_clusters_store() Dan Carpenter
@ 2017-06-23 12:14 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-06-23 12:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Andreas Dilger, linux-ext4, kernel-janitors
On Fri, Jun 23, 2017 at 12:28:00PM +0300, Dan Carpenter wrote:
> The test if kstrtoull() failed is reversed so we can't set cluster_store
> any more.
>
> Fixes: 76d33bca5581 ("ext4: refactor sysfs support code")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, this should already be fixed in the ext4.git tree.
- Ted
commit f5b877c913026b9c5d4d1ac2916eff46c49b37a0
Author: Chao Yu <yuchao0@huawei.com>
Date: Fri Jun 23 01:08:22 2017 -0400
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>
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index d74dc5f81a04..48c7a7d55ed3 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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-23 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23 9:28 [PATCH] ext4: fix reserved_clusters_store() Dan Carpenter
2017-06-23 12:14 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox