Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 202bc843 authored by Jamie Hill-Daniel's avatar Jamie Hill-Daniel Committed by Greg Kroah-Hartman
Browse files

UPSTREAM: 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: default avatarJamie Hill-Daniel <jamie@hill-daniel.co.uk>
Signed-off-by: default avatarWilliam Liu <willsroot@protonmail.com>
Tested-by: default avatarSalvatore Bonaccorso <carnil@debian.org>
Tested-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 722d94847de29310e8aa03fcbdb41fc92c521756)
Bug: 213421437
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: Ica4c894715daae0d4393a377ac3e81260a651df9
parent f2bbf1b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -585,7 +585,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 &&