Skip to content

Commit 5f50087

Browse files
Murad Masimovgregkh
authored andcommitted
cifs: Fix integer overflow while processing acregmax mount option
[ Upstream commit 7489161 ] User-provided mount parameter acregmax 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: 5780464 ("cifs: Add new parameter "acregmax" for distinct file and directory metadata timeout") 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 f04e466 commit 5f50087

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
@@ -1284,11 +1284,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
12841284
}
12851285
break;
12861286
case Opt_acregmax:
1287-
ctx->acregmax = HZ * result.uint_32;
1288-
if (ctx->acregmax > CIFS_MAX_ACTIMEO) {
1287+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
12891288
cifs_errorf(fc, "acregmax too large\n");
12901289
goto cifs_parse_mount_err;
12911290
}
1291+
ctx->acregmax = HZ * result.uint_32;
12921292
break;
12931293
case Opt_acdirmax:
12941294
ctx->acdirmax = HZ * result.uint_32;

0 commit comments

Comments
 (0)