Article View: linux.kernel.netdev
Article #25449Re: [PATCH net v5] sctp: fail the association when the INIT-ACK cannot be processed
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 19:46
Date: Tue, 01 Dec 2026 19:46
170 lines
14338 bytes
14338 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The fix is incomplete.
- [Medium] Every sctp_process_init() failure in sctp_sf_do_5_1C_ack()
(net/sctp/sm_statefuns.c, around lines 606-613) is now reported as an…
--
sctp: fail the association when the INIT-ACK cannot be processed
This patch calls sctp_process_init() and sctp_auth_asoc_init_active_key()
directly from sctp_sf_do_5_1C_ack() instead of queueing them as side-effect
commands. If either step fails, the association is aborted with
sctp_stop_t1_and_abort(). The now unused SCTP_CMD_PEER_INIT and
SCTP_CMD_ASSOC_SHKEY commands are removed.
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index 6a4205de0aa69..206fa0b6cd4b8 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -603,13 +603,26 @@ enum sctp_disposition sctp_sf_do_5_1C_ack(struct net *net,
>
> initchunk = (struct sctp_init_chunk *)chunk->chunk_hdr;
>
> - sctp_add_cmd_sf(commands, SCTP_CMD_PEER_INIT,
> - SCTP_PEER_INIT(initchunk));
> + if (!sctp_process_init((struct sctp_association *)asoc, chunk,
> + sctp_source(chunk), initchunk, GFP_ATOMIC)) {
> + if (err_chunk)
> + sctp_chunk_free(err_chunk);
> + return sctp_stop_t1_and_abort(net, commands,
> + SCTP_ERROR_NO_RESOURCE, ENOMEM,
> + asoc, chunk->transport);
> + }
[Severity: Medium]
sctp_process_init() returns 0 for allocation failures and also for peer
or policy rejections. Does this report ENOMEM for failures that have
nothing to do with memory?
The non-memory cases are the !src_match check, sctp_process_param()
rejections, and the ASCONF-without-AUTH check. That last check is active
by default because addip_noauth is 0:
net/sctp/sm_make_chunk.c:sctp_process_init() {
...
if (!asoc->base.net->sctp.addip_noauth &&
(asoc->peer.asconf_capable && !asoc->peer.auth_capable)) {
...
goto clean_up;
}
...
}
In those cases sctp_cmd_set_sk_err() sets sk->sk_err = ENOMEM on
non-UDP-style sockets. That value is what SO_ERROR returns after a
non-blocking connect(), and later sock_error() callers see it too. The
SCTP_ASSOC_CHANGE / SCTP_CANT_STR_ASSOC notification also carries
SCTP_ERROR_NO_RESOURCE.
A blocking connect() still returns ECONNREFUSED or ETIMEDOUT from
sctp_wait_for_connect(), because that path ignores sk_err.
The verification failure path just above reports a similar peer-caused
rejection as ECONNREFUSED with SCTP_ERROR_INV_PARAM. Before this patch the
-ENOMEM from the interpreter was dropped, T1-init kept retransmitting, and
the application eventually saw ETIMEDOUT.
The commit message says the ASCONF-without-AUTH case now aborts at once,
but it doesn't say that userspace will see ENOMEM / NO_RESOURCE for it.
Could the non-memory rejections report a different error here?
The comment in sctp_process_init() also still says:
* also give us an option to silently ignore the packet, which
* is what we'll do here.
The INIT-ACK path is the only caller with a non-temporary association,
and it now tears the association down instead. Should this comment be
updated?
>
> /* SCTP-AUTH: generate the association shared keys so that
> * we can potentially sign the COOKIE-ECHO.
> */
> - sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_SHKEY, SCTP_NULL());
> + if (sctp_auth_asoc_init_active_key((struct sctp_association *)asoc,
> + GFP_ATOMIC)) {
> + if (err_chunk)
> + sctp_chunk_free(err_chunk);
> + return sctp_stop_t1_and_abort(net, commands,
> + SCTP_ERROR_NO_RESOURCE, ENOMEM,
> + asoc, chunk->transport);
> + }
[Severity: High]
The commit message describes the bug as:
with the peer marked AUTH capable and asoc->shkey still NULL, a
chunk that the peer wants authenticated ... takes a reference on the
NULL key
Can the COOKIE-ECHO restart and collision handlers still reach this state?
sctp_sf_do_dupcook_a() and sctp_sf_do_dupcook_b() both call
sctp_sf_do_assoc_update()->sctp_assoc_update(). That function commits the
peer's AUTH state before it installs the key:
net/sctp/associola.c:sctp_assoc_update() {
...
asoc->peer.auth_capable = new->peer.auth_capable;
...
kfree(asoc->peer.peer_chunks);
asoc->peer.peer_chunks = new->peer.peer_chunks;
new->peer.peer_chunks = NULL;
...
return sctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);
}
sctp_auth_asoc_init_active_key() can fail with -ENOMEM when
sctp_auth_asoc_create_secret() fails, and then asoc->shkey is never set.
Suppose the existing association had a non-AUTH peer, or was still in
COOKIE_WAIT (the dupcook_b collision case). Then shkey stays NULL while
auth_capable is now 1 and peer_chunks can list ABORT.
sctp_sf_do_assoc_update() then builds an ABORT on that association right
away:
net/sctp/sm_statefuns.c:sctp_sf_do_assoc_update() {
if (!sctp_assoc_update(asoc, new))
return 0;
abort = sctp_make_abort(asoc, NULL, sizeof(struct sctp_errhdr));
...
}
This looks like it ends at the same crash site as the KASAN report:
sctp_make_abort()
sctp_make_control()
_sctp_make_chunk()
sctp_auth_send_cid(SCTP_CID_ABORT, asoc) -> retval->auth = 1
sctp_control_set_owner_w()
chunk->shkey = asoc->shkey; /* NULL */
sctp_auth_shkey_hold(chunk->shkey);
A remote peer can trigger this if ep->auth_enable is set locally and the
same GFP_ATOMIC failure that the reproducer relies on happens. The peer
restarts or collides with an INIT that advertises AUTH (RANDOM, HMAC-ALGO,
and CHUNKS including ABORT), then echoes the cookie.
Should sctp_assoc_update() commit auth_capable and peer_chunks only after
the key is installed? Alternatively, should the ABORT built in
sctp_sf_do_assoc_update() not be authenticated?
>
> /* Reset init error count upon receipt of INIT-ACK. */
> sctp_add_cmd_sf(commands, SCTP_CMD_INIT_COUNTER_RESET, SCTP_NULL());
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179606760834.392646.8338794156534192538%40gmail.com
Technical Details
Message-ID:
<179615438903.3146.1656176944205841909@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375334-linux-kernel-netdev=dewy.ruReferences:
<179606760834.392646.8338794156534192538@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375334-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5] sctp: fail the association when the INIT-ACK cannot be processed Date: Tue, 01 Dec 2026 19:46:29 +0000 Organization: Usenet Network Message-ID: <179615438903.3146.1656176944205841909@kernel.org> References: <179606760834.392646.8338794156534192538@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1805863"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:smTudYSbROO4wDKuwutXOmg5Fio= sha256:egkIJYuF6rdVgQDwFW5olYCyKP/GM9gG+uXjtK5oOXw= sha1:c/PjVyHqH4F2v0XOIIU2JvMiggw= sha256:aHHQ/rSqNVKmnTxf9khfFhoRbKnUJKFdv5IZqNICwYo= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 4D4F0117485; Tue, 1 Dec 2026 22:46:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d5Eo3tgCNGa2; Tue, 1 Dec 2026 22:46:45 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375334-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B3D7A11746B; Tue, 1 Dec 2026 22:46:36 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 52B672D9CF; Tue, 1 Dec 2026 19:46:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796154391; b=UsMy1zvMwcHTQpA2NTa5Bc+qhQk5NENLN2SZ4Gdk7XoE/GiNKaSG9CED2XwTlUKVthYS fHTEFHCksL7PJHi3C1Ox5u8WxnhA30X3yFhZ+ymtOgEdwBTkFO5OzhMzETWMHc51dLkC6 tnM1+Vagx8XnS7/Ciq2NLno1y+F5NA3RwSd9SYQEd+dCn/ZfDdk72wmhHyrsVhIt9ArLZ aK0b0ACFglw4vMdWSmdYUV2R7a0qGY1YRsTwbcOUq+6lzwU3x3m7Acfo5/8llUpNMYW68 vdviqDUXVsRCawEZmd8thWKkLbOsmi1l94s1awZy+14cVmsODfKGbkwtUCGXF8s68/A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154391; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=4xF1Xw64oHf18m3R5j1PLivnCt5WngOk09NsE9tXPlM=; b=Epg8je6D8t/tAPwfBH6NGBkOtiEpJD7OBljqzNQx4rhJC/2e2OK9v7iPDiFa/umuQYl0 nUet26W9w0QtlwcGlrP2xnFjQPhconr76r7dlRRAean4Rg9c0c1p02ut4Qc92KslwF8so QeQHhETLSYxOTlE3hF4keg1Z9xI/WuQZNxM1DV/qDJ+evDYgOxah7wNQf2C5ZwOlvZs1c RaDj+CnAk5RMc6GexvVIVI36TcmDtxLHuLYKMPWVWjaPGs6HEWwdh4NvNtki8aSIj0CZ3 SlxXIfIGPl8G/MzDl2yeRmuDgV1uZxiXaMpWEHfUDHhqrv2CCLGHp+M1fq/Jy9eKM5Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kKWXsNGv; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EDE1606A322; Tue, 1 Dec 2026 19:46:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kKWXsNGv X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796154390; b=tSJiJRtjHMH36qJIhxpQkM/FZIYvawxyI/n5dwHRRouA+MxkeIlDOpb6+TncKHdk9NH+ iwwAqRt57zU0JchJaH1eIOt2Uyr1y5HxQeqb0DzInn7WYRQ5s6IWKH4Bb+jWgg30CAX2f HGuzDSAMkuKQ0vuMVrLWPfdkWkXP+08D3uJZJyEfZoBda4+FEQL1QwvrIBAPudP3SXA3M WnMcCG1iaywnsULaLljuoZsvDexcb2cCvYd7sDAf5Ska9UKaBQrOI9yZc32wzq+qXpz0F WGRC5KhO3q4OCoKFqQNkknZCJHhLF7UVlBWfKTj27eLMBbKe1DlaBl/NAaj0AbMRzGQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154390; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=4xF1Xw64oHf18m3R5j1PLivnCt5WngOk09NsE9tXPlM=; b=Ccw37ZlYdnjPlv4kEMDbk+esS6DQMMKI5SaQOEXgUSPNHwYG+OGVLHMJllef7gaWtf9+ nyarCw0bHSBgU2PXTHLF00pCFvlTDwEk03UvFT8BAEoGAD+v18NPETUD5Exi1cd2Q6Zw6 7mROvs8lzajrSCAHz5H7+gfnjYVpGlQyLes9XhY1LdqZe1cTSccuNgBSXigo3l7RJuy5I hV7mraLo877a1G25Gm33b/jJL1fQBhINF+aXaRf3XXMEs3OIxhxa2pmKSOTZN7ntayIT8 3r2xubpw12Kkzy7JWsiEP0BinuzCgYgY0cLnYd04Lv2sA18smua/dmU6qd9XVRXBq3A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kKWXsNGv; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DC0F606A68B; Tue, 1 Dec 2026 19:46:30 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F3381F00897; Tue, 1 Dec 2026 19:46:29 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154390; bh=4xF1Xw64oHf18m3R5j1PLivnCt5WngOk09NsE9tXPlM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=kKWXsNGvybJ3FT1G+X3FjnjJOnHf1iq5R2w9VcT1lT03K1eij9sh3zKvU3ByNAg/+ NldI+5vYS7XYj8OnUlxqTWhLxdrmgCkptnAWbU2gUHHXFCYw8YBJ/cZB2ieVCTiGxN oFYkpH+oKiAkt4qhuyUqsVjm0rvg16FvPJqS74VufNo/WPtyzZ+FYtF722de/ImL6c bsUwQHMfPwX/phMmNm/HBxPg5mt/XxcqqQBqxwbjBRvDEuqyvrjtn8/tPseCiL5nLq 9yjtbiT0koaKQwYJkEBnhlo6AmeahV7HPXsyWh0KzUD3jvve0uMU57+B4z/NYqVSko BosuwYfrNscCA== X-Cc: lucien.xin@gmail.com, marcelo.leitner@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, junvyyang@tencent.com, linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <179606760834.392646.8338794156534192538@gmail.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list