Commit fd966aaf authored by Florian Westphal's avatar Florian Westphal Committed by Ben Hutchings

batman-adv: fix skb deref after free

commit 63d443ef upstream.

batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len.

Fixes: 95332477 ("batman-adv: network coding - buffer unicast packets before forward")
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Reviewed-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: default avatarAntonio Quartulli <a@unstable.cc>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 188e5f79
...@@ -568,6 +568,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -568,6 +568,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
struct batadv_unicast_packet *unicast_packet; struct batadv_unicast_packet *unicast_packet;
struct ethhdr *ethhdr = eth_hdr(skb); struct ethhdr *ethhdr = eth_hdr(skb);
int res, hdr_len, ret = NET_RX_DROP; int res, hdr_len, ret = NET_RX_DROP;
unsigned int len;
unicast_packet = (struct batadv_unicast_packet *)skb->data; unicast_packet = (struct batadv_unicast_packet *)skb->data;
...@@ -608,6 +609,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -608,6 +609,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
if (hdr_len > 0) if (hdr_len > 0)
batadv_skb_set_priority(skb, hdr_len); batadv_skb_set_priority(skb, hdr_len);
len = skb->len;
res = batadv_send_skb_to_orig(skb, orig_node, recv_if); res = batadv_send_skb_to_orig(skb, orig_node, recv_if);
/* translate transmit result into receive result */ /* translate transmit result into receive result */
...@@ -615,7 +617,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -615,7 +617,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
/* skb was transmitted and consumed */ /* skb was transmitted and consumed */
batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD); batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES, batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
skb->len + ETH_HLEN); len + ETH_HLEN);
ret = NET_RX_SUCCESS; ret = NET_RX_SUCCESS;
} else if (res == NET_XMIT_POLICED) { } else if (res == NET_XMIT_POLICED) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment