Skip to content

Commit 722d948

Browse files
clubby789torvalds
authored andcommitted
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 <[email protected]> Signed-off-by: William Liu <[email protected]> Tested-by: Salvatore Bonaccorso <[email protected]> Tested-by: Thadeu Lima de Souza Cascardo <[email protected]> Acked-by: Dan Carpenter <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8357f6f commit 722d948

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fs_context.c

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

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

0 commit comments

Comments
 (0)