Commit 86b29d83 authored by Felix Fietkau's avatar Felix Fietkau Committed by David S. Miller

net: bridge: fix corrupted ethernet header on multicast-to-unicast

The change from skb_copy to pskb_copy unfortunately changed the data
copying to omit the ethernet header, since it was pulled before reaching
this point. Fix this by calling __skb_push/pull around pskb_copy.

Fixes: 59c878cb ("net: bridge: fix multicast-to-unicast with fraglist GSO")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6963c508
...@@ -258,6 +258,7 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, ...@@ -258,6 +258,7 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,
{ {
struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
const unsigned char *src = eth_hdr(skb)->h_source; const unsigned char *src = eth_hdr(skb)->h_source;
struct sk_buff *nskb;
if (!should_deliver(p, skb)) if (!should_deliver(p, skb))
return; return;
...@@ -266,12 +267,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, ...@@ -266,12 +267,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,
if (skb->dev == p->dev && ether_addr_equal(src, addr)) if (skb->dev == p->dev && ether_addr_equal(src, addr))
return; return;
skb = pskb_copy(skb, GFP_ATOMIC); __skb_push(skb, ETH_HLEN);
if (!skb) { nskb = pskb_copy(skb, GFP_ATOMIC);
__skb_pull(skb, ETH_HLEN);
if (!nskb) {
DEV_STATS_INC(dev, tx_dropped); DEV_STATS_INC(dev, tx_dropped);
return; return;
} }
skb = nskb;
__skb_pull(skb, ETH_HLEN);
if (!is_broadcast_ether_addr(addr)) if (!is_broadcast_ether_addr(addr))
memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN);
......
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