Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] sctp: diag: fix stack garbage in IPv6 scope_id during dump_one lookup
@ 2026-11-25 15:49 Xin Long
  0 siblings, 0 replies; 2+ messages in thread
From: Xin Long @ 2026-11-25 15:49 UTC (permalink / raw)
  To: network dev, linux-sctp
  Cc: davem, kuba, Eric Dumazet, Paolo Abeni, Simon Horman,
	Marcelo Ricardo Leitner

As gomaja noticed, sctp_diag_dump_one() builds IPv6 lookup addresses on
the stack but never initializes sin6_scope_id or sin6_flowinfo. For
link-local addresses, __sctp_v6_cmp_addr() compares scope_ids when both
are non-zero, so stack garbage in these fields can cause sporadic lookup
failures.

Zero-initialize both laddr and paddr to ensure sin6_scope_id is 0, which
acts as a wildcard in __sctp_v6_cmp_addr(), matching any scope, just as
TCP and UDP handle idiag_if purely as a device filter (dif) parameter
without conflating it with IPv6 scope_id.

The dif check in sctp_addrs_lookup_transport() already filters by
sk_bound_dev_if, so scope_id on the lookup addresses is unnecessary.

Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
v2:
  - Add a Fixes tag and target net.git.
  - Fix the issue by zero-initializing laddr/paddr instead of explicitly
    setting sin6_scope_id to 0 (reported by Clashiko).
---
 net/sctp/diag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/diag.c b/net/sctp/diag.c
index c2a0de2adf6f..564a5b51e6ce 100644
--- a/net/sctp/diag.c
+++ b/net/sctp/diag.c
@@ -433,7 +433,7 @@ static int sctp_diag_dump_one(struct netlink_callback *cb,
 	struct sk_buff *skb = cb->skb;
 	struct net *net = sock_net(skb->sk);
 	const struct nlmsghdr *nlh = cb->nlh;
-	union sctp_addr laddr, paddr;
+	union sctp_addr laddr = {}, paddr = {};
 	int dif = req->id.idiag_if;
 	struct sctp_comm_param commp = {
 		.skb = skb,
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] sctp: diag: fix stack garbage in IPv6 scope_id during dump_one lookup
@ 2026-11-25 15:53 netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-25 15:53 UTC (permalink / raw)
  To: Xin Long
  Cc: network dev, linux-sctp, davem, kuba, Eric Dumazet, Paolo Abeni,
	Simon Horman, Marcelo Ricardo Leitner

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 15:53 [PATCH net v2] sctp: diag: fix stack garbage in IPv6 scope_id during dump_one lookup netdev-bot+sinfo
  -- strict thread matches above, loose matches on Subject: below --
2026-11-25 15:49 Xin Long

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