Skip to content

Commit 7489161

Browse files
Murad MasimovSteve French
authored andcommitted
cifs: Fix integer overflow while processing acregmax mount option
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>
1 parent fc99045 commit 7489161

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
@@ -1344,11 +1344,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13441344
}
13451345
break;
13461346
case Opt_acregmax:
1347-
ctx->acregmax = HZ * result.uint_32;
1348-
if (ctx->acregmax > CIFS_MAX_ACTIMEO) {
1347+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
13491348
cifs_errorf(fc, "acregmax too large\n");
13501349
goto cifs_parse_mount_err;
13511350
}
1351+
ctx->acregmax = HZ * result.uint_32;
13521352
break;
13531353
case Opt_acdirmax:
13541354
ctx->acdirmax = HZ * result.uint_32;

0 commit comments

Comments
 (0)