Skip to contentSkip to conversation

f2fs: don't allow negative ->write_io_size_bits

PATCH New Chao Yu 1 participant 1 message Feb 14, 2019 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: don't allow negative ->write_io_size_bits

From: Chao Yu <[email protected]>

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.]

---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
index be8be445c6ed..230845221c74 100644
@@ -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);
Signature · 1 line
2.18.0