aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Hill-Daniel <[email protected]>2022-01-18 08:06:04 +0100
committerLinus Torvalds <[email protected]>2022-01-18 09:23:19 +0200
commit722d94847de29310e8aa03fcbdb41fc92c521756 (patch)
treed2c1b136bdbac7375aa5c7e8c37726f2999ae2c7
parent8357f6fb3d9a02ac55f0d758b9c79b4647c18bcb (diff)
vfs: fs_context: fix up param length parsing in legacy_parse_param
The "PAGE_SIZE - 2 - size" calculation in legacy_parse_param() is an unsigned type so a large value of "size" results in a high positive value instead of a negative value as expected. Fix this by getting rid of the subtraction. Signed-off-by: Jamie Hill-Daniel <[email protected]> Signed-off-by: William Liu <[email protected]> Tested-by: Salvatore Bonaccorso <[email protected]> Tested-by: Thadeu Lima de Souza Cascardo <[email protected]> Acked-by: Dan Carpenter <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--fs/fs_context.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fs_context.c b/fs/fs_context.c
index b7e43a780a62..24ce12f0db32 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -548,7 +548,7 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
param->key);
}
- if (len > PAGE_SIZE - 2 - size)
+ if (size + len + 2 > PAGE_SIZE)
return invalf(fc, "VFS: Legacy: Cumulative options too large");
if (strchr(param->key, ',') ||
(param->type == fs_value_is_string &&