From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A800C43458 for ; Tue, 30 Jun 2026 02:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=roUf/zuvB6EYzKdWEjz0GHQvKg6pHRTjmrvxGeJquGQ=; b=yyvtK3/Cb3o9JN5lP8TWjfRjTv t/ddXuWFrTIktlia5PAUq7xN5C91+7eNmVJvL6KcFj4hzAGKLKwyYVCteSN6AatZpR0sBRBHZC2ht CViX1H6Rx806pIxE9hlujccutcXBbEPajNK8LW47EPekyD3R2/wAvlys3osJLlAYBEKSTMrUnb4d0 BlmOSScsOsb6whZ4IR6iRpuoK2EAUZCmFzzqdcobu3LFWTa8mZ9G3Z7phx1mwfkbwkoMiY259E9/0 vn7IjRjafuu+oyaL3SLJ1QsR7Aa2RWbAB2rgovCfJT86zBgj4UWfVpp7AiaTCTDN8SP4fREXjQAxV iuttnXrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1weOKC-0000000FiIY-3PFd; Tue, 30 Jun 2026 02:35:48 +0000 Received: from [216.200.240.184] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1weOKA-0000000FiHx-0YFo; Tue, 30 Jun 2026 02:35:47 +0000 X-UUID: 607960be742c11f1afed4741b24580c9-20260629 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=roUf/zuvB6EYzKdWEjz0GHQvKg6pHRTjmrvxGeJquGQ=; b=UTxYgOo8+DKdBRGUkC3/T+MFxh6zOnDiQlpfKCFkQYAsONkqlfoPj8k+DWUZSGVWrLAr0sF4FMrazm7Bp0OVi0LfNeDCapGwrsz6iYOGGidQhWnokL+ZziCCQTWvpLE7AuZAi0sQBzlujzyZVSh1B1Y/k0I+PMF86iWoWbYsXS8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.17,REQID:a94a205d-73e9-41f9-9a43-72baeeeaf0f0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:d497b38,CLOUDID:5c87e26f-49ea-4ec0-9464-9dd6a9cdc4ef,B ulkID:nil,BulkQuantity:0,SF:102|836|865|888|898,TC:-5,Content:0|15|50|99,E DM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,COL:0,OSI:0,OSA:0, AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 607960be742c11f1afed4741b24580c9-20260629 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 359347101; Mon, 29 Jun 2026 19:35:37 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 30 Jun 2026 10:35:34 +0800 Received: from mbjsdccf07.gcn.mediatek.inc (10.15.20.246) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Tue, 30 Jun 2026 10:35:33 +0800 From: Shiming Cheng To: , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3] Subject: [PATCH] net: gro: fix double aggregation of flush-marked skbs Date: Tue, 30 Jun 2026 10:35:02 +0800 Message-ID: <20260630023512.26927-1-shiming.cheng@mediatek.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260629_193546_197882_1DA9ECBB X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The new skb_gro_receive_list() function is missing a critical safety check present in the legacy skb_gro_receive() path. Specifically, it does not validate NAPI_GRO_CB(skb)->flush before allowing packet aggregation. This allows already-GRO'd packets with existing frag_list to be re-aggregated into a new GRO session, corrupting the frag_list chain structure. When skb_segment() attempts to unpack these malformed packets, it encounters invalid state and triggers a kernel panic. Scenario (Tethering/Device forwarding): 1. Driver: Generated aggregated packet P1 via LRO with frag_list 2. Dev A: Receives aggregated fraglist packet and flush flag set 3. Dev A: Re-enters GRO, skb_gro_receive_list() is called 4. Missing flush check allows re-aggregation despite flush flag 5. Frag_list chain becomes corrupted (loops or dangling refs) 6. Dev B: TX path calls skb_segment(), crashes on corrupted frag_list Root cause in skb_segment(): The check at line ~4891: if (hsize <= 0 && i >= nfrags && skb_headlen(list_skb) && (skb_headlen(list_skb) == len || sg)) { When frag_list is corrupted by double aggregation, when list_skb is a NULL pointer from skb->next, skb_headlen(list_skb) dereference NULL/corrupted pointers occurs. Call Trace: skb_headlen(NULL skb) skb_segment tcp_gso_segment tcp4_gso_segment inet_gso_segment skb_mac_gso_segment __skb_gso_segment skb_gso_segment validate_xmit_skb validate_xmit_skb_list sch_direct_xmit qdisc_restart __qdisc_run qdisc_run net_tx_action Fix: Add NAPI_GRO_CB(skb)->flush validation to the early-return check in skb_gro_receive_list(), matching the defensive programming pattern of skb_gro_receive(). Fixes: 8928756d53d5 ("net: add fraglist GRO/GSO support") Cc: stable@vger.kernel.org Signed-off-by: Shiming Cheng --- net/core/gro.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/gro.c b/net/core/gro.c index 35f2f708f010..076247c1e662 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -229,7 +229,8 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb) { - if (unlikely(p->len + skb->len >= 65536)) + if (unlikely(p->len + skb->len >= 65536 || + NAPI_GRO_CB(skb)->flush)) return -E2BIG; if (!pskb_may_pull(skb, skb_gro_offset(skb))) { -- 2.45.2