diff options
author | Murad Masimov <m.masimov@mt-integration.ru> | 2025-03-11 17:22:04 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2025-03-13 08:41:27 -0500 |
commit | 5b29891f91dfb8758baf1e2217bef4b16b2b165b (patch) | |
tree | 51e6e5f0a4b4d7550d9c654155d676eafb73d093 /fs | |
parent | 7489161b1852390b4413d57f2457cd40b34da6cc (diff) | |
download | linux-5b29891f91dfb8758baf1e2217bef4b16b2b165b.tar.gz linux-5b29891f91dfb8758baf1e2217bef4b16b2b165b.tar.bz2 linux-5b29891f91dfb8758baf1e2217bef4b16b2b165b.zip |
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: 4c9f948142a5 ("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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/client/fs_context.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 5f3c5967a0f5..c983021c406b 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1351,11 +1351,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, ctx->acregmax = HZ * result.uint_32; break; case Opt_acdirmax: - ctx->acdirmax = HZ * result.uint_32; - if (ctx->acdirmax > CIFS_MAX_ACTIMEO) { + if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) { cifs_errorf(fc, "acdirmax too large\n"); goto cifs_parse_mount_err; } + ctx->acdirmax = HZ * result.uint_32; break; case Opt_actimeo: if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) { |