From e6b6d5911a2b3da4f73b95ff9572ba21158fdf32 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 12 Jan 2022 09:26:20 -0300 Subject: [PATCH] UBUNTU: SAUCE: vfs: test that one given mount param is not larger than PAGE_SIZE In order to avoid potential overflows, test that one given mount parameter is not larger than PAGE_SIZE when parsing it through legacy_parse_param. Suggested-by: Stefan Bader Signed-off-by: Thadeu Lima de Souza Cascardo CVE-2022-0185 Acked-by: Andy Whitcroft Acked-by: Ben Romer --- fs/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fs_context.c b/fs/fs_context.c index a195e516f5bd2..d2588a06c6b99 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 (size + len + 2 > PAGE_SIZE) + if (len > PAGE_SIZE || size + len + 2 > PAGE_SIZE) return invalf(fc, "VFS: Legacy: Cumulative options too large"); if (strchr(param->key, ',') || (param->type == fs_value_is_string &&