aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMurad Masimov <m.masimov@mt-integration.ru>2025-03-11 17:22:06 +0300
committerSteve French <stfrench@microsoft.com>2025-03-13 08:41:28 -0500
commitd5a30fddfe2f2e540f6c43b59cf701809995faef (patch)
treefa1c9111a8582b4f97583ad8e2cac4c2a1c7756a
parentcifs: Fix integer overflow while processing actimeo mount option (diff)
downloadwireguard-linux-d5a30fddfe2f2e540f6c43b59cf701809995faef.tar.xz
wireguard-linux-d5a30fddfe2f2e540f6c43b59cf701809995faef.zip
cifs: Fix integer overflow while processing closetimeo mount option
User-provided mount parameter closetimeo 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: 5efdd9122eff ("smb3: allow deferred close timeout to be configurable") Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/fs_context.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index 85b062e7f48d..8c73d4d60d1a 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1370,11 +1370,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
ctx->acdirmax = ctx->acregmax = HZ * result.uint_32;
break;
case Opt_closetimeo:
- ctx->closetimeo = HZ * result.uint_32;
- if (ctx->closetimeo > SMB3_MAX_DCLOSETIMEO) {
+ if (result.uint_32 > SMB3_MAX_DCLOSETIMEO / HZ) {
cifs_errorf(fc, "closetimeo too large\n");
goto cifs_parse_mount_err;
}
+ ctx->closetimeo = HZ * result.uint_32;
break;
case Opt_echo_interval:
ctx->echo_interval = result.uint_32;