mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] coda: fix timeout sysctl width on big-endian architecture
@ 2026-10-29 10:57 Fernando Fernandez Mancera
  0 siblings, 0 replies; only message in thread
From: Fernando Fernandez Mancera @ 2026-10-29 10:57 UTC (permalink / raw)
  To: coda
  Cc: codalist, jaharkes, linux-kernel, linux-fsdevel,
	Fernando Fernandez Mancera

coda_timeout is an unsigned long, but the "timeout" sysctl entry uses
proc_dointvec() with .maxlen = sizeof(int), so the handler accesses only
four bytes of the eight-byte variable.

On little-endian this works, since the four bytes are the low half. On
64-bit big-endian they are the high half. The sysctl reads back 0
instead of the default 30, and writing N sets coda_timeout to N * 2^32 +
30 seconds, so a stuck upcall effectively never becomes interruptible.

Fix this by using proc_doulongvec_minmax() handler and adjust the
maxlen to the right value.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
Note: found this while fixing a similar issue on SMC sockets. This is
janitorial work, I don't think CODA is used in big-endian at all.
---
 fs/coda/sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 0df46f09b6cc..73bc48460453 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -18,9 +18,9 @@ static const struct ctl_table coda_table[] = {
 	{
 		.procname	= "timeout",
 		.data		= &coda_timeout,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(unsigned long),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec
+		.proc_handler	= proc_doulongvec_minmax
 	},
 	{
 		.procname	= "hard",
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-29 10:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 10:57 [PATCH] coda: fix timeout sysctl width on big-endian architecture Fernando Fernandez Mancera

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

all inboxes | Powered by JetHome®