Skip to content

Commit b24edd5

Browse files
Murad Masimovgregkh
authored andcommitted
cifs: Fix integer overflow while processing closetimeo mount option
[ Upstream commit d5a30fd ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4df7ec9 commit b24edd5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/smb/client/fs_context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,11 +1310,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13101310
ctx->acdirmax = ctx->acregmax = HZ * result.uint_32;
13111311
break;
13121312
case Opt_closetimeo:
1313-
ctx->closetimeo = HZ * result.uint_32;
1314-
if (ctx->closetimeo > SMB3_MAX_DCLOSETIMEO) {
1313+
if (result.uint_32 > SMB3_MAX_DCLOSETIMEO / HZ) {
13151314
cifs_errorf(fc, "closetimeo too large\n");
13161315
goto cifs_parse_mount_err;
13171316
}
1317+
ctx->closetimeo = HZ * result.uint_32;
13181318
break;
13191319
case Opt_echo_interval:
13201320
ctx->echo_interval = result.uint_32;

0 commit comments

Comments
 (0)