[PATCH batadv v2 1/5] batman-adv: access unicast_ttvn skb->data only after skb realloc
Sven Eckelmann <[email protected]> Sun, 28 Jun 2026 09:25:34 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
The pskb_may_pull() called by batadv_get_vid() 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 ethernet header but missed for the unicast_packet pointer. Reported-by: Sashiko <[email protected]> Fixes: 580d7919f19e ("batman-adv: add the VLAN ID attribute to the TT entry") Signed-off-by: Sven Eckelmann <[email protected]> --- net/batman-adv/routing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 208c5d4d..10168d23 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -894,8 +894,8 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, if (skb_cow(skb, sizeof(*unicast_packet)) < 0) return false; - unicast_packet = (struct batadv_unicast_packet *)skb->data; vid = batadv_get_vid(skb, hdr_len); + unicast_packet = (struct batadv_unicast_packet *)skb->data; ethhdr = (struct ethhdr *)(skb->data + hdr_len); /* do not reroute multicast frames in a unicast header */ -- 2.47.3