Skip to content

Commit eadde28

Browse files
clubby789gregkh
authored andcommitted
vfs: fs_context: fix up param length parsing in legacy_parse_param
commit 722d948 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>
1 parent c5f3827 commit eadde28

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
530530
param->key);
531531
}
532532

533-
if (len > PAGE_SIZE - 2 - size)
533+
if (size + len + 2 > PAGE_SIZE)
534534
return invalf(fc, "VFS: Legacy: Cumulative options too large");
535535
if (strchr(param->key, ',') ||
536536
(param->type == fs_value_is_string &&

0 commit comments

Comments
 (0)