From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>, <linux-nfs@vger.kernel.org>
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>
Subject: [PATCH 0/2]
Date: Mon, 8 Dec 2025 23:03:35 +0300 [thread overview]
Message-ID: <20251208200345.20414-1-s.shtylyov@omp.ru> (raw)
The nfs_client::cl_lease_time field (as well as the jiffies variable it's
used with) is declared as *unsigned long*, which is 32-bit type on 32-bit
arches and 64-bit type on 64-bit arches. When nfs4_set_lease_period() that
sets nfs_client::cl_lease_time is called, 32-bit nfs_fsinfo::lease_time
field is multiplied by HZ -- that might overflow before being implicitly
cast to *unsigned long*. Actually, there's no need to multiply by HZ at
all the call sites of nfs4_set_lease_period() -- it makes more sense to do
that once, inside that function. That way, we can avoid such overflow by
capping the lease period at e.g. 1 hour before multipying it by HZ...
The patches below are against the linux-next branch of Trond Myklebust's
linux-nfs.git repo.
Sergey Shtylyov (2):
NFSv4: pass lease period in seconds to nfs4_set_lease_period()
NFSv4: limit lease period in nfs4_set_lease_period()
fs/nfs/nfs4_fs.h | 3 +--
fs/nfs/nfs4proc.c | 2 +-
fs/nfs/nfs4renewd.c | 15 ++++++++++++---
fs/nfs/nfs4state.c | 2 +-
4 files changed, 15 insertions(+), 7 deletions(-)
--
2.52.0
next reply other threads:[~2025-12-08 20:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 20:03 Sergey Shtylyov [this message]
2025-12-08 20:03 ` [PATCH 1/2] NFSv4: pass lease period in seconds to nfs4_set_lease_period() Sergey Shtylyov
2025-12-08 20:03 ` [PATCH 2/2] NFSv4: limit lease period in nfs4_set_lease_period() Sergey Shtylyov
2025-12-08 20:07 ` [PATCH 0/2] Sergey Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251208200345.20414-1-s.shtylyov@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox