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: skbuff: convert BUG_ON to warning and error return during linearization
Date: Wed, 04 Nov 2026 06:37:44 -0800	[thread overview]
Message-ID: <6aeb4338.3389765f.1918dd.0000.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: skbuff: convert BUG_ON to warning and error return during linearization
Author: gowtham398gs@gmail.com

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


When receiving an SCTP packet that is nonlinear (such as an SCTP GSO packet
constructed with fragments in frag_list), sctp_rcv attempts to linearize
the packet using skb_linearize() if the sk_buff is cloned (e.g.,
tapped by a packet socket or shared) or not recognized as GSO. During
linearization via __skb_linearize() and __pskb_pull_tail(),
skb_copy_bits() fails with -EFAULT due to a discrepancy in frag_list fragment
lengths or readable offsets, triggering a BUG_ON assertion failure.
In production builds, this BUG() results in an invalid opcode oops
and kernel panic, causing an immediate denial of service.

Fix this issue by removing the fatal BUG_ON() assertion in the core
network buffer layer (__pskb_pull_tail) when skb_copy_bits() encounters a
layout or length mismatch. Instead, log a rate-limited error message using
pr_err_ratelimited() and return NULL.

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/core/skbuff.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 48f676411724..f76fe6972859 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2900,8 +2900,12 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
 			return NULL;
 	}
 
-	BUG_ON(skb_copy_bits(skb, skb_headlen(skb),
-			     skb_tail_pointer(skb), delta));
+	if (unlikely((skb_copy_bits(skb, skb_headlen(skb),
+			     skb_tail_pointer(skb), delta))){
+		pr_err_ratelimited("skbuff: length discrepancy"
+				   "detected in %s.\n", __func__);
+		return NULL;
+	}
 
 	/* Optimization: no fragments, no reasons to preestimate
 	 * size of pulled pages. Superb.
-- 
2.56.0


      parent reply	other threads:[~2026-11-04 14:37 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 ` Forwarded: [PATCH] net: sctp: linearize cloned gso packets in sctp_rcv syzbot
2026-11-04 14:37 ` syzbot [this message]

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=6aeb4338.3389765f.1918dd.0000.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®