Article View: linux.kernel.netdev
Article #17299Re: [PATCH net 4/5] sctp: use skb_set_transport_header_careful() in sctp_v6_err()
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 15:47
Date: Mon, 16 Nov 2026 15:47
89 lines
11745 bytes
11745 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท 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).
- [Medium] The main part of this concern is fixed later in the series.
--
sctp: use skb_set_transport_header_careful() in sctp_v6_err()
sctp_v6_err() now stores the ICMPv6 inner transport offset with
skb_set_transport_header_careful(). If the offset does not fit in the
16-bit skb->transport_header field, the ICMPv6 error is ignored. Before,
the offset was silently truncated and sctp_err_lookup() read the SCTP
header from the wrong place.
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index 97390569c4bdc..ad5c951efdf06 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -170,8 +170,11 @@ static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> /* Fix up skb to look at the embedded net header. */
> saveip = skb->network_header;
> savesctp = skb->transport_header;
> + if (unlikely(!skb_set_transport_header_careful(skb, offset))) {
> + __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
> + return -EINVAL;
> + }
> skb_reset_network_header(skb);
> - skb_set_transport_header(skb, offset);
> sk = sctp_err_lookup(net, AF_INET6, skb, sctp_hdr(skb), &asoc, &transport);
[Severity: Medium]
This covers native SCTP. Can the SCTP-over-UDPv6 handler in the same file
still hand a wrapped transport header to sctp_err_lookup()?
sctp_udp_v6_err() is installed as encap_err_lookup. It still does an
unchecked 16-bit add:
net/sctp/ipv6.c:sctp_udp_v6_err() {
...
skb->transport_header += sizeof(struct udphdr);
sk = sctp_err_lookup(net, AF_INET6, skb, sctp_hdr(skb), &asoc, &t);
...
}
A later patch in this series ("udp: use skb_set_transport_header_careful()
in __udp6_lib_err_encap()") makes __udp6_lib_err_encap() store the UDP
header offset carefully. That check only makes sure the UDP header offset
itself fits and is not U16_MAX, so transport_header can still be as high
as 0xFFFE when sctp_udp_v6_err() runs.
For a UDP header offset between 0xFFF7 and 0xFFFE, adding 8 gives a bad
value:
- 0xFFF7 becomes 0xFFFF, the "not set" value. With CONFIG_DEBUG_NET this
trips the DEBUG_NET_WARN_ON_ONCE() in skb_transport_header().
- 0xFFF8 to 0xFFFE wrap to 0..6, so sctp_hdr(skb) points at
skb->head + 0..6.
In the wrapped case, sctp_err_lookup() reads vtag from the wrong bytes.
sctp_v6_from_skb(), called through af->from_skb, also reads sh->source and
sh->dest from there for the association lookup. When vtag == 0, the INIT
chunk is read with skb_header_pointer() at a negative
skb_transport_offset().
The commit message says "Should the value be truncated, sctp_err_lookup()
would read the SCTP header at the wrong place". Would it make sense to
also check, before the += in sctp_udp_v6_err(), that transport_header +
sizeof(struct udphdr) fits in 16 bits and is not U16_MAX? Another option
is for __udp6_lib_err_encap() to reserve room for the payload header.
This needs the same large skb->data - skb->head precondition the series
describes, and there is no reproducer.
> /* Put back, the original pointers. */
> skb->network_header = saveip;
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113124625.4010206-1-edumazet%40kernel.org
Technical Details
Message-ID:
<179484404697.3136.10852363970744263229@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364517-linux-kernel-netdev=dewy.ruReferences:
<20261113124625.4010206-5-edumazet@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364517-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 4/5] sctp: use skb_set_transport_header_careful() in sctp_v6_err() Date: Mon, 16 Nov 2026 15:47:26 +0000 Organization: Usenet Network Message-ID: <179484404697.3136.10852363970744263229@kernel.org> References: <20261113124625.4010206-5-edumazet@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2103213"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XfZFfJJuCBHSD3JLWXn1SObwYrk= sha256:KfRCjS8O1K53yScCTJ7QB3boTDOEnRq/hHat34OOID0= sha1:EpGVGpNYlPsj85E0EnPKG3cUA5E= sha256:iiwG5tcpE3Oq+e+h6CXXbMHmVKzGJl92FvNgt8duV20= 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 6EC82114CBC; Mon, 16 Nov 2026 18:47:48 +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 PZT0hhZ2aeA8; Mon, 16 Nov 2026 18:47:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364517-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 50DE1114CB6; Mon, 16 Nov 2026 18:47:32 +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 C6D0D2BCD0; Mon, 16 Nov 2026 15:47:29 +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=1794844049; b=KLGYOX7NuiaAxArq1m1qiFgpEURRwO0UP5pd7kDi2mPaCEATvZC6wZ28SgqxMCdjVMNT 56gLb8wXBfWq861GuVCbgOmIpt7CnRCiL1rEZzEzpfm5hLpT3BCOqAW+9m+ihQBFky12s W/IpM5zU+LQGbhAeGb9axVsVanUmzvEu52Hz9TSw2syhsp61kfhVEbHUXFJAUG6zRdBqE Uplh50HMBLty3AoZKVyHbW+RejPvs+SqeGMgROTxlMs3fILFRKxDDasps1ETcK7w8ghKj 6fNwEADVJndAghz67beaMuJLuPoQP86byy+erYNTLrhCngLHchAfioYOuXVIQPxJlDg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794844049; 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=DgvSdpgqo/6Q3DRzr9oY0yJxYdWV9SFCTzt1+TEwysk=; b=FuzQ41hgfxE/QS1rzhV26/s9EGk2gppqXrV1nEozdWLGIuIVVJe3aoErQja0octuK85u YNVJbQideW8Cvp3h1cCP4mUeyvZT/b8AgOT+HhnJIofvwg381NejuzPPejgDNAMuQh+fe JyJ6nek/d49Rny7o1RC5lTf/m4Rn57YOjuOKvfwmhTVAr1Npnu1eXzSic9EuifnFYOLwN c54Fuob+PVPU6GgcfnwcanpmaeAjgh7wlwspGzdWmn0UsDHOyhABlznuqCL2gyK6kCpi0 VRxdsKoq90C4cVmefJexESsWv6uiZiJKj4XpsCCaeihZNBdYNl/n0ToEu8p1ItG6/6Q== 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=CpviVmx5; 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 9EF52606A32C; Mon, 16 Nov 2026 15:47:29 +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=CpviVmx5 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=1794844048; b=c9b5euQWwbkjv+7jQ6tq+2dqUB7DF+BOBrALSC7ctzlAsRY/uHnzbWi1+UTIarCIBZLh seAY6hicTzkAEJgZ3ZemYvW5PUbCW44LpZ0ClI5VaE+gp6lHXmolrnWXDqiCBzsvP7m9G zzN2jnWgAfd5UAicUHiGASEwLIf6DPa8ADoIrObxb2VQR5YXjlxwue/LArUg6djd/P4YR xHZ6ubHv5OHeO/sb/LOxqytyKS3rCwtwfijQ674vxwlDmIt6daq5frfLrdxScSqDbs+Bl pG03DUc4aN0EyUaXzyge+tBEsxh7G3nHOy7sieyYpAXjx5OHB+7K0ajl7Q2I+QKwINw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794844048; 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=DgvSdpgqo/6Q3DRzr9oY0yJxYdWV9SFCTzt1+TEwysk=; b=AmuYB4Zfn96tdQ9zY55TDwiebgC9+J69+i36Bv6Fp4GYZ2wdzXu7EM+axwJpPQjauySM 2enlsaSHRlyOgHzX5RC+7lVrK18CW/A40KOQFWfCgzhBvNZcxm+Le0FOmJwt3qTr5/hb8 bgOPbWno3q1bGDN7TKM9u1PozvMeFL5rK9Hm8yKPMd0NpBXN/0gLtzPOwX3KqMVG2qBeZ ZHgiA0YOwR8l14hfzgJ4l8RDSuqMZe6TIeiKKK99rSlgGYcB/1kP+La2Z8ZzDr0hMC4IN +5RW1zeFAe7NeKl/6mOC+FWCJGYdXlp7ZZq8uJmiTAPd/G3oNR59eSZJb1G9OQfNdUw== 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=CpviVmx5; 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 C0568606A331; Mon, 16 Nov 2026 15:47:28 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6663D1F000C4; Mon, 16 Nov 2026 15:47:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794844048; bh=DgvSdpgqo/6Q3DRzr9oY0yJxYdWV9SFCTzt1+TEwysk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=CpviVmx5WDFRPf6kQ6D3wx0B3aUGQUHdHqQSopd9+w6X+t033cN22DD5HxXSrHy/L qwwGTNXF9rh8SDCuBS9C140u4DxW13BOqILYvnWGky/PYA5VlI93c/dh5EJvIRIacv 3MonQy5Gtf+xSWe2m5ifpVaz+1qnMyG73ezmC7gROMXLrM2c4YJNHS6Zie3HZG0ZW3 KuAOh+Tp+4gbpWA6m/wFGfALRrul9jC27DpMFJBYbmLRLJIpIQYTVxxEDhUaMprk9l 14XPOLVmT96NGnln6NHdAaPYHB2pQW4EJhFwYtKDeuISGHnVyMQ5xqPxY+97Maqy/Z Hm2M6gL4/BhQQ== X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, dsahern@kernel.org, idosch@nvidia.com, willemdebruijn.kernel@gmail.com, marcelo.leitner@gmail.com, lucien.xin@gmail.com, aconole@redhat.com, echaudro@redhat.com, i.maximets@ovn.org, daniel@iogearbox.net, justin.iurman@gmail.com, linus.luessing@c0d3.blue, sd@queasysnail.net, sbrivio@redhat.com, imv4bel@gmail.com, netdev@vger.kernel.org, linux-sctp@vger.kernel.org, dev@openvswitch.org, stable@vger.kernel.org X-In-Reply-To: <20261113124625.4010206-5-edumazet@kernel.org> X-sashiko-severity: Medium 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