* [PATCH net] sctp: validate Cookie Preservative in the first pass
@ 2026-11-27 3:35 Sun Yiqi
2026-11-27 3:39 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Sun Yiqi @ 2026-11-27 3:35 UTC (permalink / raw)
To: netdev
Cc: linux-sctp, marcelo.leitner, lucien.xin, davem, edumazet, kuba,
pabeni, willemb, horms, trilobyte777, luoxiaoxing, Sun Yiqi
The Cookie Preservative parameter is eight bytes long, including a
32-bit lifespan increment. The generic SCTP parameter walk accepts
shorter parameters, so sctp_process_param() can read beyond the
parameter and expose data to the peer.
Validate the fixed length during the first parameter walk in
sctp_verify_init() and use the existing invalid-parameter-length
handler for mismatches. The second pass can return success before
checking all parameters, while sctp_process_init() walks the list
again. Checking the length in the first pass covers that path too.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://lists.openwall.net/netdev/2026/07/29/316
Signed-off-by: Sun Yiqi <sunyiqi2@huawei.com>
---
net/sctp/sm_make_chunk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index ba0474c2a0bc..01b1eea0222c 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2317,6 +2317,12 @@ int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
return sctp_process_inv_mandatory(asoc, chunk, errp);
sctp_walk_params(param, peer_init) {
+ /* Validate the length even if the second pass stops early. */
+ if (param.p->type == SCTP_PARAM_COOKIE_PRESERVATIVE &&
+ ntohs(param.p->length) != sizeof(*param.life))
+ return sctp_process_inv_paramlength(asoc, param.p,
+ chunk, errp);
+
if (param.p->type == SCTP_PARAM_STATE_COOKIE)
has_cookie = true;
}
--
2.51.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] sctp: validate Cookie Preservative in the first pass
2026-11-27 3:35 [PATCH net] sctp: validate Cookie Preservative in the first pass Sun Yiqi
@ 2026-11-27 3:39 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-27 3:39 UTC (permalink / raw)
To: Sun Yiqi
Cc: netdev, linux-sctp, marcelo.leitner, lucien.xin, davem, edumazet,
kuba, pabeni, willemb, horms, trilobyte777, luoxiaoxing
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- 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-27 3:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 3:35 [PATCH net] sctp: validate Cookie Preservative in the first pass Sun Yiqi
2026-11-27 3:39 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox