Skip to content

Commit 86b29d8

Browse files
nbd168davem330
authored andcommitted
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: 59c878c ("net: bridge: fix multicast-to-unicast with fraglist GSO") Signed-off-by: Felix Fietkau <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6963c50 commit 86b29d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/bridge/br_forward.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,
258258
{
259259
struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
260260
const unsigned char *src = eth_hdr(skb)->h_source;
261+
struct sk_buff *nskb;
261262

262263
if (!should_deliver(p, skb))
263264
return;
@@ -266,12 +267,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,
266267
if (skb->dev == p->dev && ether_addr_equal(src, addr))
267268
return;
268269

269-
skb = pskb_copy(skb, GFP_ATOMIC);
270-
if (!skb) {
270+
__skb_push(skb, ETH_HLEN);
271+
nskb = pskb_copy(skb, GFP_ATOMIC);
272+
__skb_pull(skb, ETH_HLEN);
273+
if (!nskb) {
271274
DEV_STATS_INC(dev, tx_dropped);
272275
return;
273276
}
274277

278+
skb = nskb;
279+
__skb_pull(skb, ETH_HLEN);
275280
if (!is_broadcast_ether_addr(addr))
276281
memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN);
277282

0 commit comments

Comments
 (0)