From: Ben Greear <greearb@candelatech.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] network: Allow af_packet to transmit +4 bytes for VLAN packets.
Date: Fri, 11 Feb 2011 09:38:26 -0800 [thread overview]
Message-ID: <4D557412.7000209@candelatech.com> (raw)
In-Reply-To: <1297407446.2493.5.camel@edumazet-laptop>
On 02/10/2011 10:57 PM, Eric Dumazet wrote:
> Le jeudi 10 février 2011 à 13:59 -0800, greearb@candelatech.com a
> écrit :
>> From: Ben Greear<greearb@candelatech.com>
>>
>> This allows user-space to send a '1500' MTU VLAN packet on a
>> 1500 MTU ethernet frame. The extra 4 bytes of a VLAN header is
>> not usually charged against the MTU when other parts of the
>> network stack is transmitting vlans...
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>> ---
>> :100644 100644 91cb1d7... ef7f378... M net/packet/af_packet.c
>> net/packet/af_packet.c | 31 +++++++++++++++++++++++++++++--
>> 1 files changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index 91cb1d7..ef7f378 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -466,7 +466,7 @@ retry:
>> */
>>
>> err = -EMSGSIZE;
>> - if (len> dev->mtu + dev->hard_header_len)
>> + if (len> dev->mtu + dev->hard_header_len + VLAN_HLEN)
>> goto out_unlock;
>>
>> if (!skb) {
>> @@ -497,6 +497,19 @@ retry:
>> goto retry;
>> }
>>
>> + if (len> (dev->mtu + dev->hard_header_len)) {
>> + /* Earlier code assumed this would be a VLAN pkt,
>> + * double-check this now that we have the actual
>> + * packet in hand.
>> + */
>> + struct ethhdr *ehdr;
>> + skb_reset_mac_header(skb);
>> + ehdr = eth_hdr(skb);
>> + if (ehdr->h_proto != htons(ETH_P_8021Q)) {
>> + err = -EMSGSIZE;
>> + goto out_unlock;
>
> This would leak skb.
>
>> + }
>> + }
>>
>> skb->protocol = proto;
>> skb->dev = dev;
Can you double-check that? Seems to me that in that method the out_unlock
falls through to the out_free case. The other method is the opposite, funny
enough...
Thanks,
Ben
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next prev parent reply other threads:[~2011-02-11 17:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-10 21:59 [PATCH 1/2] igb: Allow extra 4 bytes on RX for vlan tags greearb
2011-02-10 21:59 ` [PATCH 2/2] network: Allow af_packet to transmit +4 bytes for VLAN packets greearb
2011-02-11 6:57 ` Eric Dumazet
2011-02-11 17:38 ` Ben Greear [this message]
2011-02-11 18:18 ` Eric Dumazet
2011-02-11 15:46 ` [PATCH 1/2] igb: Allow extra 4 bytes on RX for vlan tags Jeff Kirsher
2011-02-17 11:04 ` Jeff Kirsher
2011-02-17 17:28 ` Ben Greear
2011-07-21 0:18 ` Jesse Gross
2011-07-21 0:27 ` Ben Greear
2011-07-21 1:21 ` Jeff Kirsher
2011-07-21 6:35 ` Alexander Duyck
2011-07-21 21:44 ` Jesse Gross
2011-08-25 18:51 ` Ben Greear
2011-08-25 23:31 ` Alexander Duyck
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=4D557412.7000209@candelatech.com \
--to=greearb@candelatech.com \
--cc=eric.dumazet@gmail.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).