summaryrefslogtreecommitdiff
path: root/fs/fs_context.c
diff options
context:
space:
mode:
authorJamie Hill-Daniel <jamie@hill-daniel.co.uk>2022-01-18 10:06:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-20 11:13:14 +0300
commite192ccc17ecf3e78a1c6fb81badf9b50bd791115 (patch)
tree9c8aabb69808a751530c18f9d675634c67cad949 /fs/fs_context.c
parentc78c39a91dd4aa8a622a3300391e1f2bd5b33549 (diff)
downloadlinux-e192ccc17ecf3e78a1c6fb81badf9b50bd791115.tar.xz
vfs: fs_context: fix up param length parsing in legacy_parse_param
commit 722d94847de29310e8aa03fcbdb41fc92c521756 upstream. 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 <jamie@hill-daniel.co.uk> Signed-off-by: William Liu <willsroot@protonmail.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fs_context.c')
-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 &&