]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()
authorEric Dumazet <edumazet@google.com>
Tue, 14 Jan 2020 21:00:35 +0000 (13:00 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:03:29 +0000 (19:03 +0100)
commit 1712b2fff8c682d145c7889d2290696647d82dab upstream.

I missed the fact that macvlan_broadcast() can be used both
in RX and TX.

skb_eth_hdr() makes only sense in TX paths, so we can not
use it blindly in macvlan_broadcast()

Fixes: 96cc4b69581d ("macvlan: do not assume mac_header is set in macvlan_broadcast()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jurgen Van Ham <juvanham@gmail.com>
Tested-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/macvlan.c

index d67119e561d6b12aae2bfa7839866a2f26b4ae61..02efd2775dcf48a6724c97bcba6f1b5f9983fcad 100644 (file)
@@ -162,7 +162,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
                              struct net_device *src,
                              enum macvlan_mode mode)
 {
-       const struct ethhdr *eth = skb_eth_hdr(skb);
+       const struct ethhdr *eth = eth_hdr(skb);
        const struct macvlan_dev *vlan;
        struct sk_buff *nskb;
        unsigned int i;
@@ -345,10 +345,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
        const struct macvlan_dev *dest;
 
        if (vlan->mode == MACVLAN_MODE_BRIDGE) {
-               const struct ethhdr *eth = (void *)skb->data;
+               const struct ethhdr *eth = skb_eth_hdr(skb);
 
                /* send to other bridge ports directly */
                if (is_multicast_ether_addr(eth->h_dest)) {
+                       skb_reset_mac_header(skb);
                        macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
                        goto xmit_world;
                }