Skip to content

Commit 2510859

Browse files
RSmirnov512smfrench
authored andcommitted
cifs: fix integer overflow in match_server()
The echo_interval is not limited in any way during mounting, which makes it possible to write a large number to it. This can cause an overflow when multiplying ctx->echo_interval by HZ in match_server(). Add constraints for echo_interval to smb3_fs_context_parse_param(). Found by Linux Verification Center (linuxtesting.org) with Svace. Fixes: adfeb3e ("cifs: Make echo interval tunable") Cc: [email protected] Signed-off-by: Roman Smirnov <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 8b175e2 commit 2510859

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/smb/client/fs_context.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13831383
ctx->closetimeo = HZ * result.uint_32;
13841384
break;
13851385
case Opt_echo_interval:
1386+
if (result.uint_32 < SMB_ECHO_INTERVAL_MIN ||
1387+
result.uint_32 > SMB_ECHO_INTERVAL_MAX) {
1388+
cifs_errorf(fc, "echo interval is out of bounds\n");
1389+
goto cifs_parse_mount_err;
1390+
}
13861391
ctx->echo_interval = result.uint_32;
13871392
break;
13881393
case Opt_snapshot:

0 commit comments

Comments
 (0)