Skip to content

Commit 6124cbf

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 5f50087 commit 6124cbf

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
@@ -1291,11 +1291,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
12911291
ctx->acregmax = HZ * result.uint_32;
12921292
break;
12931293
case Opt_acdirmax:
1294-
ctx->acdirmax = HZ * result.uint_32;
1295-
if (ctx->acdirmax > CIFS_MAX_ACTIMEO) {
1294+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
12961295
cifs_errorf(fc, "acdirmax too large\n");
12971296
goto cifs_parse_mount_err;
12981297
}
1298+
ctx->acdirmax = HZ * result.uint_32;
12991299
break;
13001300
case Opt_actimeo:
13011301
if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {

0 commit comments

Comments
 (0)