Skip to content

Commit 9e438d0

Browse files
Murad Masimovgregkh
authored andcommitted
cifs: Fix integer overflow while processing acdirmax mount option
[ Upstream commit 5b29891 ] User-provided mount parameter acdirmax 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: 4c9f948 ("cifs: Add new mount parameter "acdirmax" to allow caching directory metadata") 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 0252c33 commit 9e438d0

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
@@ -1273,11 +1273,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
12731273
ctx->acregmax = HZ * result.uint_32;
12741274
break;
12751275
case Opt_acdirmax:
1276-
ctx->acdirmax = HZ * result.uint_32;
1277-
if (ctx->acdirmax > CIFS_MAX_ACTIMEO) {
1276+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
12781277
cifs_errorf(fc, "acdirmax too large\n");
12791278
goto cifs_parse_mount_err;
12801279
}
1280+
ctx->acdirmax = HZ * result.uint_32;
12811281
break;
12821282
case Opt_actimeo:
12831283
if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {

0 commit comments

Comments
 (0)