From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10AA736167E for ; Wed, 1 Jul 2026 01:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782870883; cv=none; b=MkR1CUdBMKUmcsxx2te9yJ7BhOE6iQ88qTu1DUQjYSouX+Q2C21CsFZEvD7CRvwALVGjdfd3/zL0aILVRKBurJLVQR3ujx1jlpwKiXEj94nl16T5Vfn8HIBYzBNypaOIRMUnif3lHxkjEpi27d7Osnfa3922MrMaLipIWwJk1g0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782870883; c=relaxed/simple; bh=oPFoD+Gy41Us98atv6JBSNlzcvWGF8SfRZGdEZUx3VE=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=WrclMTWM6eQA9VSoZafDSiXacOKgqY8wqj4ybhI5PohyK1DtgmqFlnkYRNZcLNCsuUUDTKkhO9NbdknYBaTD/UzvVzNvOHgOKcRcsMwuyuhngKL+Qi468zJIKUhkIwy25EzmC5Ji5UMJu9MaoFStFtWvX0aqqHxOyBTVUMU/NEo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Vf3zTw9i; arc=none smtp.client-ip=209.85.128.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vf3zTw9i" Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-80cebd41372so1500027b3.3 for ; Tue, 30 Jun 2026 18:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782870879; x=1783475679; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=RMNxjGCrCOaavy8c2KM0YXIXOn6JcV1cFAWmlEIqhtE=; b=Vf3zTw9ih7sQUf1Y8jk/3l8VZVD5WU8zCynVee6uxAXBo6VWMz5k2OP3aYwrFs/l4+ T2OVZ+ytSQmjcw8S4JM7BJR63cUpCnyKaRYoFpIA0KS1/Cfk8dB9F1N+1g26Tg37kzbI 4YEScdIhukwc7bYPeDlDljRrYmcrxODsF40s0o6S6XribOELQTTZ51CFIbU5/rofbQ0o 8TMFzJXm1ZdMETuWGJiYjOqrRPnzghkYC7YBvtN3TJjBTm77FMbxuP2OCiHY1r8bBppd 3yM6vy7qr1607EFZWlEih/uAW5DdKB8EVoEN/oYW6LT+3vrubzdDfY/N8QzcWVejnvHd xEhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782870879; x=1783475679; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RMNxjGCrCOaavy8c2KM0YXIXOn6JcV1cFAWmlEIqhtE=; b=FTpapd65Wq35VCQBzARCTjgHhzJiDpwV48I8ivoBNzr6ffaUfjtHQQrJQGc549++AX CalyabqCC9xjZhRToxTBmQyyEavBGZwqBVMJtNECUMV5XchrT6U9SErNNLYq9NfV15ST ozzfPNkWY+8UEbZYPhRxUBQKaXXYxMrS49ICQnFHpm0mPINuRvYYuo4BoovUSgQmPtQv u0HoT/YL6+zpaYDMWCMxj/7ib14cMUK/QKBbsgMinD31b7A3nQIFs7KGmy9TdIifsONL g6iBUOaTDbcDw1DT0D5uYyGnUgcfog6fiY3w2u4A0Qoe60amBYpLjJl3n85OFXKTiV/H UVuQ== X-Forwarded-Encrypted: i=1; AHgh+Rr1gql7cjF9CGfhn0qik4VBBvpYJgWGo81tgvLTIfu8DgUE7Chc/Obwe2sT7CHOhFqqqjFyNKY=@vger.kernel.org X-Gm-Message-State: AOJu0YygkYJeOjc4Da/EwdWlC2FMhmxFWqfUtjUJueqWgVRFfLnsjy53 co4MAefq1a/6MGkkpvH4JUNnNwEBCn5dFU+NRPpNxvSaAzxfwl+66rKBoFf8sw== X-Gm-Gg: AfdE7ck0XRs2RhpnHYvxwy/v98NdluELrMcZjJ1YAeNIdU1TkYLXKDP7lnKmLX199uU oYIexGOGLI68m4+jl1d1B5WBvucr4loCKy0P6Yu0Ygx0tIebiwLpADXUFUAmUiCXWUAiZWUHSYw 0VZHoMuwveViFUfr3LEblZaGlMQZ+UALuAbExtPPkvu0lnXExHIsDzbg9oxPwtq6ZezHMul3Ldn unmW3/TeZSuaGV6wAVeyg/G7zVeO/ZusPF0XmeZfaRoGckPkn4cc/XM4TiuXD7VrLeIgIFu2l6N JAYG1c5PkukLYsCx6gWtwwLKadqlaLKz96WRbI8Q0fCo8CuvnocVL/96Zw9VvizCYiBGACt2pln /AwVjZ4J5f3RN7GfN4CA12hT9OMqG1s0Im0g09KY5uvpiDonh/JXRR1QUcHJqrtCWbLRXzmx+2m LmX4EyAy+WziP916bYOKlngwGbky5mNTPKxuyd2JAo5EEwY8GunFND2cjUhpEzJ4LWMCth87z6K XSI X-Received: by 2002:a05:690c:9c09:b0:80c:85c6:898f with SMTP id 00721157ae682-81204145786mr27480377b3.62.1782870878859; Tue, 30 Jun 2026 18:54:38 -0700 (PDT) Received: from gmail.com (172.235.85.34.bc.googleusercontent.com. [34.85.235.172]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8128ae35a73sm2498767b3.17.2026.06.30.18.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 18:54:38 -0700 (PDT) Date: Tue, 30 Jun 2026 21:54:37 -0400 From: Willem de Bruijn To: Shiming Cheng , netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, willemb@google.com, imv4bel@gmail.com, alice@isovalent.com, eilaimemedsnaimel@gmail.com, sd@queasysnail.net, steffen.klassert@secunet.com Cc: lena.wang@mediatek.com, stable@vger.kernel.org, Shiming Cheng Message-ID: In-Reply-To: <20260626084451.27699-1-shiming.cheng@mediatek.com> References: <20260626084451.27699-1-shiming.cheng@mediatek.com> Subject: Re: [PATCH v2] Subject: [PATCH] net: gro: fix double aggregation of flush-marked skbs Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Thanks for the fix. There is something weird with your subject lines: [PATCH v2] Subject: [PATCH] net: > The new skb_gro_receive_list() function is missing a critical safety check > present in the legacy skb_gro_receive() path. , as of commit 0ab03f353d36 ("net-gro: Fix GRO flush when receiving a GSO packet."). Please add a comment referring to this commit, as it well explains the need for the flush. > 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: 9dc2c3cd6c11 ("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))) {