From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384208; b=IQO1N0SYkmetcX10XQkVaxz2hKYVDi+M/pglo+4KOISc12PkI2kKFZGbU6pq4FyxmCvx R4OS6jyjsgySfsQieiCjh5wxNFRYyNNWmpb2L9rNNoDgsnIVSZIdUBX0X8krI6g98wlZq h1v6k4REFW6bnBdRwDuFGUFmyyrH2F6edmVQK+o2qQvRS99vGiszdxRG7NYVoZNLas3zn jfhJX39zE2ZtZcgCl0zpWVTucly8eTThxyIK/31yuf0h4zzKDTYteJUDEUZ+VYrvQdu+h KSAQoF6+ZQeWrlwzAAyxS7eoeI+J3O09yTMIlw3hoqGIwnE8ZzvxOLNum7W73IwJfxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384208; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=f15LYYTd/NusMvNVdG3l7iHK+rtEejuLxao7nLOdKs8=; b=UPyeXi6Za1Q/ejxVg2i7Gmq+0oPq5bIGQgSrioYcvr360aEFxfI6UqsDXjgCRLjVvCbo uW3ZJNwvLyHME9o+o6njgfww1Bw6hhKvq3HfcfXc92in64YGzHQhClGJEdVMjGcjVi4SW BLh7Vo7/WjU0Q5Aida4vWw12nwzhRjjeb2T8IFdoRVsA+nXRlgxMJFBBJ5PTcJvPxRUCK 0PN6uDLgwg+ped8Fu9CkHQUuVMgW/zg5HyXGg7kyJrGd6xp/j0GZTwwDcIwXbaHjszAFx 8MXVLlM2PvLavbxJHU1/efG8JxdLOSFfvIYVB+ApP+3oLDhX2Qpyk4lCtXaju4bacOA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PbzzAzb8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E17CD606A322; Fri, 4 Dec 2026 11:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PbzzAzb8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BDE21F000CE; Fri, 4 Dec 2026 11:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384207; bh=f15LYYTd/NusMvNVdG3l7iHK+rtEejuLxao7nLOdKs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PbzzAzb8WewprdfBnsiOjsd0mgzju5F+/n64ybrVmsSvz0oFxoAHfI/bDYqtScZXk aYe1BZnQFmdaP3H/ARS+5+9sFHBd3gibdlNG7U5j2hvGXxMw89l/ArCvPJRCYs74/c shMRPxkYKjfG4O86GtjN83CMTfzOvSkq6vS8aBWs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+d29af9ef5c96a3f5e96c@syzkaller.appspotmail.com, Shuai Liu <847807867@qq.com>, Steffen Klassert , Paolo Abeni Subject: [PATCH 6.12 540/555] xfrm: interface: drop non-IP packets before pskb_inet_may_pull() Date: Fri, 4 Dec 2026 19:09:43 +0900 Message-ID: <20261204100629.207309660@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuai Liu <847807867@qq.com> commit e509726660dd06ce107437aecf7c106c9d3fc1e7 upstream. AF_XDP sockets bound to an xfrm interface submit skbs with skb->protocol unset (0) and skb->network_header still 0 from the __alloc_skb() zero-initialization; skb_reserve() only moves data NET_SKB_PAD bytes into the headroom. Since commit 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit"), xfrmi_xmit() calls pskb_inet_may_pull() unconditionally. For such a skb, pskb_inet_may_pull_reason() selects nhlen = 0 for the unknown protocol and pskb_may_pull_reason() receives len = skb_network_offset(skb) = network_header - data = -64, which as unsigned int exceeds INT_MAX and trips the DEBUG_NET_WARN_ON_ONCE(len > INT_MAX) in pskb_may_pull_reason(): WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline] WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline] WARNING: ./include/net/ip_tunnels.h:488 at xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534 RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline] Call Trace: __dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164 __xsk_generic_xmit net/xdp/xsk.c:1288 [inline] xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344 xsk_poll+0x326/0x670 net/xdp/xsk.c:1472 The packet is dropped by the pull returning PKT_TOO_SMALL and hitting the default case afterwards anyway, so the only visible effect is the warning; reject unknown protocols before the pull to restore the pre-86de3a1118a16 behavior of dropping them silently via the switch default. Reported-by: syzbot+d29af9ef5c96a3f5e96c@syzkaller.appspotmail.com Closes: https://syzbot.org/bug?extid=d29af9ef5c96a3f5e96c Fixes: 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit") Cc: stable@vger.kernel.org Signed-off-by: Shuai Liu <847807867@qq.com> Acked-by: Steffen Klassert Link: https://patch.msgid.link/tencent_46F20906773869221623F9FA26275C133107@qq.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_interface_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/xfrm/xfrm_interface_core.c +++ b/net/xfrm/xfrm_interface_core.c @@ -532,6 +532,14 @@ static netdev_tx_t xfrmi_xmit(struct sk_ memset(&fl, 0, sizeof(fl)); + switch (skb->protocol) { + case htons(ETH_P_IPV6): + case htons(ETH_P_IP): + break; + default: + goto tx_err; + } + if (!pskb_inet_may_pull(skb)) goto tx_err;