diff mbox

[net-next,1/2] net: reset mac header in dev_start_xmit()

Message ID 1360131740.28557.25.camel@edumazet-glaptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Feb. 6, 2013, 6:22 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

On 64 bit arches :

There is a off-by-one error in qdisc_pkt_len_init() because
mac_header is not set in xmit path.

skb_mac_header() returns an out of bound value that was
harmless because hdr_len is an 'unsigned int'

On 32bit arches, the error is abysmal.

This patch is also a prereq for "macvlan: add multicast filter"

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ben Greear <greearb@candelatech.com>
---
 net/core/dev.c |    2 ++
 1 file changed, 2 insertions(+)



--
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

Comments

Ben Greear Feb. 6, 2013, 6:40 a.m. UTC | #1
On 02/05/2013 10:22 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> On 64 bit arches :
>
> There is a off-by-one error in qdisc_pkt_len_init() because
> mac_header is not set in xmit path.
>
> skb_mac_header() returns an out of bound value that was
> harmless because hdr_len is an 'unsigned int'
>
> On 32bit arches, the error is abysmal.
>
> This patch is also a prereq for "macvlan: add multicast filter"

I'll go ahead and apply this one to our tree for testing, and will
apply the multicast one as soon as I resolve some bugs that currently
have me swamped...

Thanks,
Ben
David Miller Feb. 6, 2013, 8:59 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 05 Feb 2013 22:22:20 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> On 64 bit arches :
> 
> There is a off-by-one error in qdisc_pkt_len_init() because
> mac_header is not set in xmit path.
> 
> skb_mac_header() returns an out of bound value that was
> harmless because hdr_len is an 'unsigned int'
> 
> On 32bit arches, the error is abysmal.
> 
> This patch is also a prereq for "macvlan: add multicast filter"
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.
--
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
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index a87bc74..0b888b5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2799,6 +2799,8 @@  int dev_queue_xmit(struct sk_buff *skb)
 	struct Qdisc *q;
 	int rc = -ENOMEM;
 
+	skb_reset_mac_header(skb);
+
 	/* Disable soft irqs for various locks below. Also
 	 * stops preemption for RCU.
 	 */