bonding: COW before overwriting the destination MAC address
Subsystems (3)
PATCH 2/2 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.
--- drivers/net/bonding/bond_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bonding/bond_main.c +5 -0
@@ -1513,6 +1513,11 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) skb->pkt_type == PACKET_HOST) {u16 *dest = (u16 *)eth_hdr (skb)->h_dest; +if (unlikely (skb_cow_head (skb, + skb->data -skb_mac_header (skb)))) { +kfree_skb (skb); +return NULL ; + }memcpy (dest, bond_dev->dev_addr,ETH_ALEN ); }
Quoted 14 lines · Changli Gao
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 <[email protected]>--- drivers/net/bonding/bond_main.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/net/bonding/bond_main.c +0
-0@@ -1513,6 +1513,11 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) skb->pkt_type == PACKET_HOST) {
drivers/net/bonding/bond_main.c static struct sk_buff *bond_handle_frame(struct sk_buff *skb) · line 1523
Quoted 10 lines
drivers/net/bonding/bond_main.c +5
-0u16 *dest = (u16 *)eth_hdr (skb)->h_dest; +if (unlikely (skb_cow_head (skb, + skb->data -skb_mac_header (skb)))) { +kfree_skb (skb); +return NULL ; + }memcpy (dest, bond_dev->dev_addr,ETH_ALEN ); }
This seems buggy.
dest points to old skb head content.
Quoted 28 lines · Eric Dumazet
Quoted 14 lines · Changli Gao
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 <[email protected]>---
drivers/net/bonding/bond_main.c | 5 +++++1 file changed, 5 insertions(+)drivers/net/bonding/bond_main.c +0
-0@@ -1513,6 +1513,11 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) skb->pkt_type == PACKET_HOST) {drivers/net/bonding/bond_main.c static struct sk_buff *bond_handle_frame(struct sk_buff *skb) · line 1523
Quoted 10 lines
drivers/net/bonding/bond_main.c +5
-0u16 *dest = (u16 *) eth_hdr(skb)->h_dest; + if (unlikely(skb_cow_head(skb, + skb->data - skb_mac_header(skb)))) { + kfree_skb(skb); + return NULL; + } memcpy(dest, bond_dev->dev_addr, ETH_ALEN); }This seems buggy.
Quoted 3 lines
dest points to old skb head content.
Oh, thanks. I'll respin it.
Signature · 2 lines
Regards, Changli Gao([email protected])