Skip to content

Commit

Permalink
vfs: fs_context: fix up param length parsing in legacy_parse_param
Browse files Browse the repository at this point in the history
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 <[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: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
clubby789 authored and gregkh committed Jan 20, 2022
1 parent c2f067d commit bd2aed0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/fs_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit bd2aed0

Please sign in to comment.