[PATCH batadv] batman-adv: retrieve ethhdr after potential skb realloc on RX
Sven Eckelmann <[email protected]> Sun, 28 Jun 2026 07:40:50 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
pskb_may_pull() in batadv_interface_rx() could reallocate the buffer behind the skb. Variables which were pointing to the old buffer need to be reassigned to avoid an use-after-free. This was done correctly for the VLAN header but missed for the ethernet header which is later used for the TT and AP isolation handling. Reported-by: Sashiko <[email protected]> Fixes: 48628bb9419f ("batman-adv: softif bridge loop avoidance") Fixes: 7d2f8a773bae ("batman-adv: Check skb size before using encapsulated ETH+VLAN header") Signed-off-by: Sven Eckelmann <[email protected]> --- net/batman-adv/mesh-interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/batman-adv/mesh-interface.c b/net/batman-adv/mesh-interface.c index e5a55d24..907968a1 100644 --- a/net/batman-adv/mesh-interface.c +++ b/net/batman-adv/mesh-interface.c @@ -434,6 +434,7 @@ void batadv_interface_rx(struct net_device *mesh_iface, if (!pskb_may_pull(skb, VLAN_ETH_HLEN)) goto dropped; + ethhdr = eth_hdr(skb); vhdr = skb_vlan_eth_hdr(skb); /* drop batman-in-batman packets to prevent loops */ --- base-commit: 70dab058ebed0bc0c66dc40113039129b3089780 change-id: 20260628-skb-post-realloc-1eb51d508d33 Best regards, -- Sven Eckelmann <[email protected]>