]> git.ipfire.org Git - thirdparty/linux.git/commit
NFSv4: limit lease period in nfs4_set_lease_period()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Mon, 8 Dec 2025 20:15:04 +0000 (23:15 +0300)
committerAnna Schumaker <anna.schumaker@oracle.com>
Mon, 9 Feb 2026 18:39:39 +0000 (13:39 -0500)
commite29a3e61eef6b6c2e60bc1872e9da3bcdbc46c17
tree323d10e636c44340411a80ebfdeacb55af291c2b
parent3d57c44e918012db1f901d50bc9195a8812ad602
NFSv4: limit lease period in nfs4_set_lease_period()

In nfs4_set_lease_period(), the passed 32-bit lease period in seconds is
multiplied by HZ -- that might overflow before being implicitly cast to
*unsigned long* (32/64-bit type), while initializing the lease variable.
Cap the lease period at MAX_LEASE_PERIOD (#define'd to 1 hour for now),
before multipying to avoid such overflow...

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Suggested-by: Trond Myklebust <trondmy@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/nfs4renewd.c