Skip to content

Commit 5b29891

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

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
@@ -1351,11 +1351,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13511351
ctx->acregmax = HZ * result.uint_32;
13521352
break;
13531353
case Opt_acdirmax:
1354-
ctx->acdirmax = HZ * result.uint_32;
1355-
if (ctx->acdirmax > CIFS_MAX_ACTIMEO) {
1354+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
13561355
cifs_errorf(fc, "acdirmax too large\n");
13571356
goto cifs_parse_mount_err;
13581357
}
1358+
ctx->acdirmax = HZ * result.uint_32;
13591359
break;
13601360
case Opt_actimeo:
13611361
if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {

0 commit comments

Comments
 (0)