From: Fernando Fernandez Mancera <fmancera@suse.de>
To: netdev@vger.kernel.org
Cc: linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
jaka@linux.ibm.com, horms@kernel.org, pabeni@redhat.com,
kuba@kernel.org, edumazet@kernel.org, davem@davemloft.net,
guwen@linux.alibaba.com, tonylu@linux.alibaba.com,
mjambigi@linux.ibm.com, sidraya@linux.ibm.com,
dust.li@linux.alibaba.com, alibuda@linux.alibaba.com,
Fernando Fernandez Mancera <fmancera@suse.de>
Subject: [PATCH net] net/smc: fix limit_smc_hs sysctl on big-endian architecture
Date: Wed, 28 Oct 2026 23:53:50 +0100 [thread overview]
Message-ID: <20261028225350.3753-1-fmancera@suse.de> (raw)
net->smc.limit_smc_hs is a bool, but its sysctl entry uses
proc_dointvec_minmax() with .maxlen = sizeof(int), so the handler
accesses four bytes at the address of a one-byte field.
On little-endian this works with the extra bytes being written in struct
padding. On big-endian (tested on s390x) the bool sits at the most
significant byte of the int therefore the bool stays false and the "1"
goes into padding. The sysctl reads back 1 but SMC sockets created
afterwards see limit_smc_hs as disabled.
Fix this by using proc_dobool() handler and adjust the maxlen to the
right value.
Fixes: f8406a2fd279 ("net/smc: add sysctl for smc_limit_hs")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
Note: After reviewing another patch fixing sysctls, I decided to
review more of them and found this. I have tested the fix on a s390x
system.
---
net/smc/smc_sysctl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
index 09dad48337f6..f58cf256f61a 100644
--- a/net/smc/smc_sysctl.c
+++ b/net/smc/smc_sysctl.c
@@ -160,11 +160,9 @@ static const struct ctl_table smc_table[] = {
{
.procname = "limit_smc_hs",
.data = &init_net.smc.limit_smc_hs,
- .maxlen = sizeof(int),
+ .maxlen = sizeof(bool),
.mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
+ .proc_handler = proc_dobool,
},
{
.procname = "smcr_max_send_wr",
--
2.56.0
reply other threads:[~2026-10-28 22:54 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=20261028225350.3753-1-fmancera@suse.de \
--to=fmancera@suse.de \
--cc=alibuda@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@kernel.org \
--cc=guwen@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=jaka@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
/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