Linux NFS development
 help / color / mirror / Atom feed
* [PATCH 0/2]
@ 2025-12-08 20:03 Sergey Shtylyov
  2025-12-08 20:03 ` [PATCH 1/2] NFSv4: pass lease period in seconds to nfs4_set_lease_period() Sergey Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sergey Shtylyov @ 2025-12-08 20:03 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, linux-nfs; +Cc: Sergey Shtylyov

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-08 20:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 20:03 [PATCH 0/2] Sergey Shtylyov
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox