Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jamie Hill-Daniel and committed by
Linus Torvalds
722d9484 8357f6fb

+1 -1
+1 -1
fs/fs_context.c
··· 548 548 param->key); 549 549 } 550 550 551 - if (len > PAGE_SIZE - 2 - size) 551 + if (size + len + 2 > PAGE_SIZE) 552 552 return invalf(fc, "VFS: Legacy: Cumulative options too large"); 553 553 if (strchr(param->key, ',') || 554 554 (param->type == fs_value_is_string &&