ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()
Subsystems (3)
PATCH 1/1 ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()
The aoe driver (or similar) generates a non-IPv6 packet (e.g., ETH_P_AOE) and queues it for transmission via dev_queue_xmit() on a 6LoWPAN interface (configured by the user or test case).
Since the packet is not IPv6, the 6LoWPAN header_ops->create function (lowpan_header_create or header_create) returns early without initializing the lowpan_addr_info structure in the skb headroom.
In the transmit function (lowpan_xmit), the driver calls lowpan_header (or setup_header) which unconditionally copies and uses the lowpan_addr_info from the headroom, which contains uninitialized data.
Fix this by dropping non IPv6 packets.
A similar fix is needed in net/bluetooth/6lowpan.c bt_xmit().
---
Cc: Alexander Aring <[email protected]>
Cc: Stefan Schmidt <[email protected]>
Cc: Miquel Raynal <[email protected]>
--- net/ieee802154/6lowpan/tx.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/6lowpan/tx.c +5 -0
@@ -255,6 +255,11 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)pr_debug ("package xmit\n" ); +if (skb->protocol !=htons (ETH_P_IPV6 )) { +kfree_skb (skb); +return NET_XMIT_DROP ; + } +WARN_ON_ONCE (skb->len >IPV6_MIN_MTU );/* We must take a copy of the skb before we modify/replace the ipv6
Signature · 1 line
2.54.0.1013.g208068f2d8-goog
Hi Eric,
Quoted 8 lines · Eric Dumazet
The aoe driver (or similar) generates a non-IPv6 packet (e.g.,
ETH_P_AOE) and queues it for transmission viadev_queue_xmit()on a 6LoWPAN interface (configured by the user or test case).Since the packet is not IPv6, the 6LoWPAN
header_ops->createfunction (lowpan_header_createorheader_create) returns early without initializing thelowpan_addr_infostructure in the skb headroom.
Quoted 5 lines
In the transmit function (
lowpan_xmit), the driver callslowpan_header(orsetup_header) which unconditionally copies and uses thelowpan_addr_infofrom the headroom, which contains uninitialized data.Fix this by dropping non IPv6 packets.
I am not sure I fully grasped the syzbot report. The problem may happen because an interface can be configured as a 6lowpan interface, which in this case should not transmit the packet, but there are other possible configurations which would just work and accept ETH_P_AOE packets (whatever that is). Is this correct? If so, then this indeed looks like the best approach,
But otherwise I guess this fix would totally prevent the AOE driver from working correctly, so I just want to double check my understanding.
Thanks,
Miquèl
Quoted 26 lines · Miquel Raynal
Hi Eric,
Quoted 8 lines · Eric Dumazet
The aoe driver (or similar) generates a non-IPv6 packet (e.g.,
ETH_P_AOE) and queues it for transmission viadev_queue_xmit()on a 6LoWPAN interface (configured by the user or test case).Since the packet is not IPv6, the 6LoWPAN
header_ops->createfunction (lowpan_header_createorheader_create) returns early without initializing thelowpan_addr_infostructure in the skb headroom.Quoted 5 lines
In the transmit function (
lowpan_xmit), the driver callslowpan_header(orsetup_header) which unconditionally copies and uses thelowpan_addr_infofrom the headroom, which contains uninitialized data.Fix this by dropping non IPv6 packets.
I am not sure I fully grasped the syzbot report. The problem may happen because an interface can be configured as a 6lowpan interface, which in this case should not transmit the packet, but there are other possible configurations which would just work and accept
ETH_P_AOEpackets (whatever that is). Is this correct? If so, then this indeed looks like the best approach,
Quoted 4 lines
Reviewed-by Miquel Raynal <[email protected]>But otherwise I guess this fix would totally prevent the AOE driver from working correctly, so I just want to double check my understanding.
Hey Miquèl,
Yes, this is only for when the interface is configured as 6lowpan, which implies IPv6 traffic.
If it's configured differently (e.g., for AOE), then it shouldn't be using the 6lowpan xmit path.
Thanks.
Miquel Raynal
maintainerQuoted 7 lines
Hey Miquèl,
Yes, this is only for when the interface is configured as 6lowpan, which implies IPv6 traffic.
If it's configured differently (e.g., for AOE), then it shouldn't be using the 6lowpan xmit path.
Ok, perfect then, thanks for the fix!
Miquèl
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 3 Jun 2026 07:29:55 +0000 you wrote:
The aoe driver (or similar) generates a non-IPv6 packet (e.g.,
ETH_P_AOE) and queues it for transmission viadev_queue_xmit()on a 6LoWPAN interface (configured by the user or test case).Since the packet is not IPv6, the 6LoWPAN
header_ops->createfunction (lowpan_header_createorheader_create) returns early without initializing thelowpan_addr_infostructure in the skb headroom.[...]
Here is the summary with links:
- [net] ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()
https://git.kernel.org/netdev/net/c/3a5f3f7aff18
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html