Skip to content

Commit d5a30fd

Browse files
Murad MasimovSteve French
authored andcommitted
cifs: Fix integer overflow while processing closetimeo mount option
User-provided mount parameter closetimeo of type u32 is intended to have an upper limit, but before it is validated, the value is converted from seconds to jiffies which can lead to an integer overflow. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 5efdd91 ("smb3: allow deferred close timeout to be configurable") Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 64f690e commit d5a30fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/smb/client/fs_context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,11 +1370,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13701370
ctx->acdirmax = ctx->acregmax = HZ * result.uint_32;
13711371
break;
13721372
case Opt_closetimeo:
1373-
ctx->closetimeo = HZ * result.uint_32;
1374-
if (ctx->closetimeo > SMB3_MAX_DCLOSETIMEO) {
1373+
if (result.uint_32 > SMB3_MAX_DCLOSETIMEO / HZ) {
13751374
cifs_errorf(fc, "closetimeo too large\n");
13761375
goto cifs_parse_mount_err;
13771376
}
1377+
ctx->closetimeo = HZ * result.uint_32;
13781378
break;
13791379
case Opt_echo_interval:
13801380
ctx->echo_interval = result.uint_32;

0 commit comments

Comments
 (0)