Skip to content

Commit 0252c33

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 d3f9fdc commit 0252c33

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
@@ -1266,11 +1266,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
12661266
}
12671267
break;
12681268
case Opt_acregmax:
1269-
ctx->acregmax = HZ * result.uint_32;
1270-
if (ctx->acregmax > CIFS_MAX_ACTIMEO) {
1269+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
12711270
cifs_errorf(fc, "acregmax too large\n");
12721271
goto cifs_parse_mount_err;
12731272
}
1273+
ctx->acregmax = HZ * result.uint_32;
12741274
break;
12751275
case Opt_acdirmax:
12761276
ctx->acdirmax = HZ * result.uint_32;

0 commit comments

Comments
 (0)