Skip to content

Commit 3c6ed31

Browse files
neocturnegregkh
authored andcommitted
batman-adv: update data pointers after skb_cow()
commit bc44b78 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: 78fc6bbe0aca ("batman-adv: add UNICAST_4ADDR packet type") Signed-off-by: Matthias Schiffer <[email protected]> Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent baed34e commit 3c6ed31

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/batman-adv/routing.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
930930
bool is4addr;
931931

932932
unicast_packet = (struct batadv_unicast_packet *)skb->data;
933-
unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
934933

935934
is4addr = unicast_packet->packet_type == BATADV_UNICAST_4ADDR;
936935
/* the caller function should have already pulled 2 bytes */
@@ -951,9 +950,13 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
951950
if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
952951
return NET_RX_DROP;
953952

953+
unicast_packet = (struct batadv_unicast_packet *)skb->data;
954+
954955
/* packet for me */
955956
if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
956957
if (is4addr) {
958+
unicast_4addr_packet =
959+
(struct batadv_unicast_4addr_packet *)skb->data;
957960
subtype = unicast_4addr_packet->subtype;
958961
batadv_dat_inc_counter(bat_priv, subtype);
959962

0 commit comments

Comments
 (0)