[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250306123514.386434-3-nicolas.bouchinet@clip-os.org>
Date: Thu, 6 Mar 2025 13:35:09 +0100
From: nicolas.bouchinet@...p-os.org
To: coda@...cmu.edu,
linux-kernel@...r.kernel.org,
codalist@...a.cs.cmu.edu,
linux-nfs@...r.kernel.org
Cc: Nicolas Bouchinet <nicolas.bouchinet@....gouv.fr>,
Joel Granados <j.granados@...sung.com>,
Clemens Ladisch <clemens@...isch.de>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jan Harkes <jaharkes@...cmu.edu>,
Trond Myklebust <trondmy@...nel.org>,
Anna Schumaker <anna@...nel.org>
Subject: [PATCH v3 2/3] sysctl/coda: Fixes timeout bounds
From: Nicolas Bouchinet <nicolas.bouchinet@....gouv.fr>
Bound coda timeout sysctl writings between SYSCTL_ZERO
and SYSCTL_INT_MAX.
The proc_handler has thus been updated to proc_dointvec_minmax.
coda_timeout type has been updated from an unsigned long to an unsigned
int since it is typically set to some value well under a minute.
Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@....gouv.fr>
---
Changes since v2:
https://lore.kernel.org/all/20250224095826.16458-4-nicolas.bouchinet@clip-os.org/
* Changed coda_timeout type from unsigned long to unsigned int as
suggested by Joel Granados and Jan Harkes.
---
fs/coda/coda_int.h | 2 +-
fs/coda/sysctl.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/coda/coda_int.h b/fs/coda/coda_int.h
index f82b59c9dd287..c7fc4c5a77d58 100644
--- a/fs/coda/coda_int.h
+++ b/fs/coda/coda_int.h
@@ -6,7 +6,7 @@ struct dentry;
struct file;
extern struct file_system_type coda_fs_type;
-extern unsigned long coda_timeout;
+extern unsigned int coda_timeout;
extern int coda_hard;
extern int coda_fake_statfs;
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 0df46f09b6cc5..d6f8206c51575 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -20,7 +20,9 @@ static const struct ctl_table coda_table[] = {
.data = &coda_timeout,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_INT_MAX,
},
{
.procname = "hard",
--
2.48.1
Powered by blists - more mailing lists