netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] bonding: COW before overwriting the destination MAC address
Date: Thu, 3 Mar 2011 14:54:36 +0800	[thread overview]
Message-ID: <AANLkTim3EKe7hqyhpQ97uBn0_8ZFP=ve3RgurQzTpi1b@mail.gmail.com> (raw)
In-Reply-To: <1299134742.2456.1.camel@edumazet-laptop>

On Thu, Mar 3, 2011 at 2:45 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 03 mars 2011 à 12:25 +0800, Changli Gao a écrit :
>> 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>
>> ---
>>  drivers/net/bonding/bond_main.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 912b416..211be52 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -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);
>>       }
>>
>
> This seems buggy.
>
> dest points to old skb head content.
>
>

Oh, thanks. I'll respin it.



-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

      reply	other threads:[~2011-03-03  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  4:25 [PATCH 2/2] bonding: COW before overwriting the destination MAC address Changli Gao
2011-03-03  6:45 ` Eric Dumazet
2011-03-03  6:54   ` Changli Gao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim3EKe7hqyhpQ97uBn0_8ZFP=ve3RgurQzTpi1b@mail.gmail.com' \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).