summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-02-15 00:16:15 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-03-05 19:58:06 -0800
commit6d52e135c8a8b2063e0a9fe1f12c06e9208a941c (patch)
treeea98d979f4b41968eb88479e82776ad833338851 /fs/f2fs
parent500e0b28ecd3c5aade98f3c3a339d18dcb166bb6 (diff)
downloadlinux-6d52e135c8a8b2063e0a9fe1f12c06e9208a941c.tar.gz
linux-6d52e135c8a8b2063e0a9fe1f12c06e9208a941c.tar.bz2
linux-6d52e135c8a8b2063e0a9fe1f12c06e9208a941c.zip
f2fs: don't allow negative ->write_io_size_bits
As Dan reported: "We put an upper bound on ->write_io_size_bits but we don't have a lower bound." So let's add lower bound check for ->write_io_size_bits in parse_options(). [We don't allow configuring ->write_io_size_bits to zero, since at least we need to fill one dummy page for aligned IO.] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index be8be445c6ed..230845221c74 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -586,7 +586,7 @@ static int parse_options(struct super_block *sb, char *options)
case Opt_io_size_bits:
if (args->from && match_int(args, &arg))
return -EINVAL;
- if (arg > __ilog2_u32(BIO_MAX_PAGES)) {
+ if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
f2fs_msg(sb, KERN_WARNING,
"Not support %d, larger than %d",
1 << arg, BIO_MAX_PAGES);