Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: 6lowpan: fix uninit-value read in bt_xmit()
@ 2026-07-12 14:14 Jiale Yao
  2026-07-12 15:38 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-07-12 14:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, luiz.dentz, linux-kernel, Jiale Yao

The bt_xmit() function lacks the skb->protocol check for IPv6 packets
that commit 3a5f3f7aff18 ("ieee802154: 6lowpan: only accept IPv6 packets
in lowpan_xmit()") added to the parallel IEEE 802.15.4 path.

A non-IPv6 packet (e.g. ETH_P_AOE) queued on a Bluetooth 6LoWPAN netdev
reaches setup_header(), which unconditionally treats the skb as IPv6 and
reads 16 bytes of uninitialized memory, causing a KMSAN uninit-value bug.

Add the missing protocol check to reject non-IPv6 packets before they
reach setup_header().

Fixes: 3a5f3f7aff18bcc36a57839cf50cf0cc8de707f3 ("ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 net/bluetooth/6lowpan.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index d504a363a30f..5729c6fbaf15 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -524,6 +524,11 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
 	 *   0 - this is a multicast packet
 	 *   1 - this is unicast packet
 	 */
+	if (skb->protocol != htons(ETH_P_IPV6)) {
+		kfree_skb(skb);
+		return NET_XMIT_DROP;
+	}
+
 	err = setup_header(skb, netdev, &addr, &addr_type);
 	if (err < 0) {
 		kfree_skb(skb);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-12 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 14:14 [PATCH] Bluetooth: 6lowpan: fix uninit-value read in bt_xmit() Jiale Yao
2026-07-12 15:38 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox