mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+f15a6eff7a53f6eb7dc3@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] net: sctp: linearize cloned gso packets in sctp_rcv
Date: Wed, 04 Nov 2026 02:49:27 -0800	[thread overview]
Message-ID: <6aeb0db7.bf891901.a11b2.0004.GAE@google.com> (raw)
In-Reply-To: <6ae3d50b.9c6421ad.36baac.0003.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] net: sctp: linearize cloned gso packets in sctp_rcv
Author: gowtham398gs@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Fix a kernel panic bug caused by an unexpected layout geometry mismatch
when flattening cloned non-linear SCTP GSO packets.

When an incoming packet is cloned (e.g., during packet capturing via
tcpdump or Wireshark), sctp_rcv() must flatten the packet into a single,
continuous memory block before parsing its chunks. However, if the packet's
internal frag_list has tracking discrepancies, calling downstream memory
handlers like __pskb_pull_tail() triggers an operational failure.
Because the kernel treats this failure as an invariant violation, it
executes a fatal BUG_ON() assertion, resulting in a system-wide panic.

Fix this issue by validating memory linearization early in sctp_rcv().
By intercepting non-zero return codes from skb_linearize(), the kernel
can detect frag_list length discrepancies before they reach the core
network buffer handlers, allowing malformed packets to be safely routed
to the discard routine rather than crashing the operating system.

Reported-by: syzbot+f15a6eff7a53f6eb7dc3@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f15a6eff7a53f6eb7dc3
Fixes: 90017accff61 ("sctp: support GSO")
Signed-off-by: Gowtham S Bhushan <gowtham398gs@gmail.com>
---
 net/sctp/input.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index 9494cfa51106..6f66ae656d70 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -116,8 +116,13 @@ int sctp_rcv(struct sk_buff *skb)
 	/* If the packet is fragmented and we need to do crc checking,
 	 * it's better to just linearize it otherwise crc computing
 	 * takes longer.
+	 *
+	 * If there is a geometry mismatch, length discrepancy, or offset corruption
+	 * in the packet, skb_linearize will fail and return
+	 * a non-zero error code.
 	 */
-	if (((!is_gso || skb_cloned(skb)) && skb_linearize(skb)) ||
+
+	if (((!is_gso || skb_cloned(skb)) && skb_linearize(skb) != 0) ||
 	    !pskb_may_pull(skb, sizeof(struct sctphdr)))
 		goto discard_it;
 
-- 
2.56.0


  parent reply	other threads:[~2026-11-04 10:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 23:21 [syzbot] [sctp?] kernel BUG in __pskb_pull_tail (2) syzbot
2026-11-04  5:03 ` syzbot
2026-11-04 10:49 ` syzbot [this message]
2026-11-04 14:37 ` Forwarded: [PATCH] net: skbuff: convert BUG_ON to warning and error return during linearization syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6aeb0db7.bf891901.a11b2.0004.GAE@google.com \
    --to=syzbot+f15a6eff7a53f6eb7dc3@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®