diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-03-16 11:29:09 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-06-16 22:22:42 +0100 |
commit | 2cb0c19c38fa7595ea3afb7ec9ea65ce51a45c13 (patch) | |
tree | 812799e4fa32c524cebce489bb6b5bc47bd0b8b3 | |
parent | c1bb4c474c52d1330b2bdc85c801ea4d9b079d62 (diff) | |
download | linux-2cb0c19c38fa7595ea3afb7ec9ea65ce51a45c13.tar.gz |
batman-adv: update data pointers after skb_cow()
commit bc44b78157f621ff2a2618fe287a827bcb094ac4 upstream.
batadv_check_unicast_ttvn() calls skb_cow(), so pointers into the SKB data
must be (re)set after calling it. The ethhdr variable is dropped
altogether.
Fixes: 7cdcf6dddc42 ("batman-adv: add UNICAST_4ADDR packet type")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16:
- There's no ethhdr variable here
- Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | net/batman-adv/routing.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 7a1032348ea9f9..5015430a954909 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -886,8 +886,6 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, bool is4addr; unicast_packet = (struct batadv_unicast_packet *)skb->data; - unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; - is4addr = unicast_packet->packet_type == BATADV_UNICAST_4ADDR; /* the caller function should have already pulled 2 bytes */ if (is4addr) @@ -907,9 +905,13 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size)) return NET_RX_DROP; + unicast_packet = (struct batadv_unicast_packet *)skb->data; + /* packet for me */ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { if (is4addr) { + unicast_4addr_packet = + (struct batadv_unicast_4addr_packet *)skb->data; batadv_dat_inc_counter(bat_priv, unicast_4addr_packet->subtype); orig_addr = unicast_4addr_packet->src; |