From 7cd3bddbfe2a6c08506b24a81079a1aa03edca1f Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 20 Jan 2020 17:17:28 -0500 Subject: [PATCH] fixes for 4.9 Signed-off-by: Sasha Levin --- ...reset_mac_header-in-macvlan_queue_xm.patch | 54 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 55 insertions(+) create mode 100644 queue-4.9/macvlan-use-skb_reset_mac_header-in-macvlan_queue_xm.patch diff --git a/queue-4.9/macvlan-use-skb_reset_mac_header-in-macvlan_queue_xm.patch b/queue-4.9/macvlan-use-skb_reset_mac_header-in-macvlan_queue_xm.patch new file mode 100644 index 00000000000..fc7c1b35884 --- /dev/null +++ b/queue-4.9/macvlan-use-skb_reset_mac_header-in-macvlan_queue_xm.patch @@ -0,0 +1,54 @@ +From ff9e3c01e6248c600774108b18d11635e04a67b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2020 13:00:35 -0800 +Subject: macvlan: use skb_reset_mac_header() in macvlan_queue_xmit() + +From: Eric Dumazet + +[ Upstream commit 1712b2fff8c682d145c7889d2290696647d82dab ] + +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 +Reported-by: Jurgen Van Ham +Tested-by: Matteo Croce +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/macvlan.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index 854947b9db4e..e2b3d3c4d4df 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -234,7 +234,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; +@@ -487,10 +487,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; + } +-- +2.20.1 + diff --git a/queue-4.9/series b/queue-4.9/series index fbfffe8152f..b840d8e568e 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -78,3 +78,4 @@ cfg80211-fix-page-refcount-issue-in-a-msdu-decap.patch netfilter-fix-a-use-after-free-in-mtype_destroy.patch netfilter-arp_tables-init-netns-pointer-in-xt_tgdtor_param-struct.patch batman-adv-fix-dat-candidate-selection-on-little-endian-systems.patch +macvlan-use-skb_reset_mac_header-in-macvlan_queue_xm.patch -- 2.47.3