mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fernando Fernandez Mancera <fmancera@suse.de>
To: coda@cs.cmu.edu
Cc: codalist@coda.cs.cmu.edu, jaharkes@cs.cmu.edu,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Fernando Fernandez Mancera <fmancera@suse.de>
Subject: [PATCH] coda: fix timeout sysctl width on big-endian architecture
Date: Thu, 29 Oct 2026 11:57:01 +0100	[thread overview]
Message-ID: <20261029105701.3829-1-fmancera@suse.de> (raw)

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


                 reply	other threads:[~2026-10-29 10:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261029105701.3829-1-fmancera@suse.de \
    --to=fmancera@suse.de \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@coda.cs.cmu.edu \
    --cc=jaharkes@cs.cmu.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®