diff options
author | Changli Gao <xiaosuo@gmail.com> | 2011-03-02 16:07:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-07 18:45:08 -0500 |
commit | 541ac7c9b30ee2ff84ad87f27e0bc069e143afb5 (patch) | |
tree | bb1e2377bf33ecee73518b0c517980f5a33b8405 /drivers/net/bonding | |
parent | cca134fe784a01cf4eb9f0621b0104591b7ddfba (diff) |
bonding: COW before overwriting the destination MAC address
When there is a ptype handler holding a clone of this skb, whose
destination MAC addresse is overwritten, the owner of this handler may
get a corrupted packet.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 912b416b7573..7b7ca971672f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1511,9 +1511,13 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | |||
1511 | if (bond_dev->priv_flags & IFF_MASTER_ALB && | 1511 | if (bond_dev->priv_flags & IFF_MASTER_ALB && |
1512 | bond_dev->priv_flags & IFF_BRIDGE_PORT && | 1512 | bond_dev->priv_flags & IFF_BRIDGE_PORT && |
1513 | skb->pkt_type == PACKET_HOST) { | 1513 | skb->pkt_type == PACKET_HOST) { |
1514 | u16 *dest = (u16 *) eth_hdr(skb)->h_dest; | ||
1515 | 1514 | ||
1516 | memcpy(dest, bond_dev->dev_addr, ETH_ALEN); | 1515 | if (unlikely(skb_cow_head(skb, |
1516 | skb->data - skb_mac_header(skb)))) { | ||
1517 | kfree_skb(skb); | ||
1518 | return NULL; | ||
1519 | } | ||
1520 | memcpy(eth_hdr(skb)->h_dest, bond_dev->dev_addr, ETH_ALEN); | ||
1517 | } | 1521 | } |
1518 | 1522 | ||
1519 | return skb; | 1523 | return skb; |