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