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 8272B47F779; Thu, 20 Aug 2026 17:56:51 +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=1787248612; cv=none; b=bu5kpgRn0d9gSSp7lUDT4yZLoJmyScUzCLWyC0uPEzVyZ9q89FBvep3BLlBCNNWLNaW1cpDvR0hofT7HBQvyaburv4HYbU++GpDdQqGdtVOCuYE52J8B9g+1uDWkVV5TCpuP+d1DCP9jSqsJGS3RX7zM/44fA03KhXiaHvczxeQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787248612; c=relaxed/simple; bh=E4zHa7U0K4CJbCWz7G5yuA0vevew+YYxUK4mapsZWRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m/OOn0LSOXbfaTDoU4UOLkW/UsFCGqxcGM07KvfNL/ZrQhmdS8WJ29IrGO+oOThQvzbSz73KGrW0zIJ6quM7K4IYys3r+CW+VCfg1kwCblu+sUrMChbsLkeywl3uYcGcjgZ/BJ3afwI7Fh9UC8shT71FVImn84OzUuZlxcHJHvg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ub2V5CRM; 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="Ub2V5CRM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5121F00A3A; Thu, 20 Aug 2026 17:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787248611; bh=S7kfAQPSZoXQBQuvd8JjvXo/pUg+v3aWFe5dieENnJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ub2V5CRMvWON7C6pwKjwU7VGIXu+amVZZubQcGCBDovHALOSpF3w4QiCH7/66ysVr f8v0K7WcR0HURNC6F0R2VxLM95j09tiPWXn0OhgpSR/jY1pD7UH5avOnMn8aodlFoy UOYbqcwUH1vjzBgpX8HtIvPcva2pKQxVy6BsMKY8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+30b93b6845b19cc38581@syzkaller.appspotmail.com, Eric Dumazet , Willem de Bruijn , Jiayuan Chen , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 289/303] af_packet: Dont send zero-byte data in tpacket_snd(). Date: Thu, 20 Aug 2026 16:57:05 +0200 Message-ID: <20260820145302.159685640@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: Eric Dumazet [ Upstream commit 6bcd76c134c55c697148acb5c0194e9666abdf84 ] syzbot reported a WARNING in __dev_queue_xmit() triggered via tpacket_snd(): skb_assert_len WARNING: at include/linux/skbuff.h:2753 skb_assert_len WARNING: at __dev_queue_xmit+0x21bc/0x4970 net/core/dev.c:4781 Call Trace: dev_queue_xmit include/linux/netdevice.h:3448 [inline] packet_xmit+0x243/0x310 net/packet/af_packet.c:276 tpacket_snd net/packet/af_packet.c:2907 [inline] packet_sendmsg+0x28d6/0x4eb0 net/packet/af_packet.c:3134 When sending 0-byte packets via TPACKET ring buffer on devices with no hard header (e.g. dev->hard_header_len == 0), tpacket_fill_skb() populates an skb with skb->len == 0 and returns 0. tpacket_snd() then forwards this empty skb to packet_xmit(), causing __dev_queue_xmit() to hit skb_assert_len(skb). Similar checks exist in packet_snd() via commit dc633700f00f ("net/af_packet: check len when min_header_len equals to 0") and in packet_sendmsg_spkt() via commit 6a341729fb31 ("af_packet: Don't send zero-byte data in packet_sendmsg_spkt()."). Return -EINVAL in tpacket_fill_skb() when skb->len is zero to reject zero-length packets in tpacket_snd(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: syzbot+30b93b6845b19cc38581@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/6a79e807.01d0871a.3a0d52.00ac.GAE@google.com/T/#u Signed-off-by: Eric Dumazet Reviewed-by: Willem de Bruijn Reviewed-by: Jiayuan Chen Link: https://patch.msgid.link/20260810150447.1220864-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/packet/af_packet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a0424dc2927a9..b3d7518c47e36 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2691,6 +2691,9 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb, len = ((to_write > len_max) ? len_max : to_write); } + if (unlikely(!skb->len)) + return -EINVAL; + packet_parse_headers(skb, sock); return tp_len; -- 2.53.0