From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F6AD47CA8F; Thu, 20 Aug 2026 17:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787248604; cv=none; b=LJdymqO0rcY222264Oif4h0qTgTk/+EGQvZJjRaI6yUtD8NYaNt5sYDyCS6NaQ/YCFSowADKmQ2IvfcU0jLvR00ZxQNo4UKq3DqS5+vV0otalfa3CLAHqZwvhjhUrCQIKNpA5+78i75miitROmAZ1+EBiYOi4VIdrJ3ydjSnQ+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787248604; c=relaxed/simple; bh=BF/f1Oxkzwyb0agIDea2QHIJV97TfM8HjeJy1LLPOaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tpDBHXcTzanlwCMYMRQhq3+9vWRGHyyDc3J76D45mKO34e6Qw3T5HOprp2nT5yXNGnWBty9ZXbBVad4dTW+eC7OP/73qC+UrcOO08gwl480SErjagX5SHB7yFmIxVsx7OConR2Sap4G4iCKluW9vWUyIPOle376DWEPafHUdo6s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SUg3FA43; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SUg3FA43" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D7531F000E9; Thu, 20 Aug 2026 17:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787248602; bh=wnagGvKXwgXw+Ewzd1Zay4TKUWLlCIvgO9DtaHz6x5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SUg3FA434nOocozNqzfVfLY8sSVxs3pvIXA8bD4uQcchaP9GCu2k6TxuWuogPsUqd qLW2ZsInaWqs8PhhK6RT11UN6CBKvwJ7A8uy85xwDwkvw6U4JeMNPFcU4RfPkvIfnO HdErONmh+JGrLwPhkqkAobvMu3hJVsaAFWPw9voY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Fang , Willem de Bruijn , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 286/303] net: packet: fix wrong transport_header when sending VLAN-tagged frame Date: Thu, 20 Aug 2026 16:57:02 +0200 Message-ID: <20260820145302.063862292@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145253.200766705@linuxfoundation.org> References: <20260820145253.200766705@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wei Fang [ Upstream commit 01fdecc0480d916c799dbee584833a4a37e94d06 ] In packet_parse_headers(), when processing a VLAN-tagged frame, skb_set_network_header() is called to advance network_header past the VLAN tag to the inner protocol header. skb_probe_transport_header() is then called with skb->protocol still set to the outer VLAN EtherType (e.g. ETH_P_8021Q), while nhoff (derived from skb_network_offset()) already points past the VLAN tag to the inner protocol header. In __skb_flow_dissect(), proto is initialized to ETH_P_8021Q and nhoff points past the VLAN tag. When the dissector hits case ETH_P_8021Q, it reads a struct vlan_hdr at nhoff via __skb_header_pointer(), but that offset contains the inner protocol header (e.g. an IP header). The bytes are misinterpreted as a VLAN header, yielding a garbage encapsulated EtherType that matches no known protocol. The dissector returns false, so skb_probe_transport_header() never calls skb_set_transport_header(), leaving transport_header at its uninitialized sentinel value (~0U). Move skb_probe_transport_header() to before skb_set_network_header(). At the time skb_probe_transport_header() is called, network_header still points to the VLAN header, so nhoff correctly points to the VLAN header. The flow dissector can then parse the VLAN header, extract the inner EtherType, and advance nhoff to the inner protocol header, allowing transport_header to be set correctly. Fixes: dfed913e8b55 ("net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO") Assisted-by: WChat:claude-opus-4-8 Signed-off-by: Wei Fang Reviewed-by: Willem de Bruijn Link: https://patch.msgid.link/20260807063405.688780-2-wei.fang@oss.nxp.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/packet/af_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 64843368bf10a..a0424dc2927a9 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1985,13 +1985,13 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock) sock->type == SOCK_RAW) skb->protocol = dev_parse_header_protocol(skb); + skb_probe_transport_header(skb); + /* Move network header to the right position for VLAN tagged packets */ if (likely(skb->dev->type == ARPHRD_ETHER) && eth_type_vlan(skb->protocol) && vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0) skb_set_network_header(skb, depth); - - skb_probe_transport_header(skb); } /* -- 2.53.0