Skip to contentSkip to conversation

coda: fix timeout sysctl width on big-endian architecture

PATCH New Fernando Fernandez Mancera 1 participant 1 message Oct 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coda: fix timeout sysctl width on big-endian architecture

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")

---
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(-)
fs/coda/sysctl.c +2 -2
index 0df46f09b6cc..73bc48460453 100644
@@ -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",
Signature · 1 line
2.56.0