Skip to contentSkip to conversation

Fix CDC_EEM with 802.1Q VLAN and 1500 MTU

PATCH In review Ian Coolidge 4 participants 6 messages Nov 8, 2012 2 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#1 lore raw

PATCH v2 2/2 net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs

In reply to Ian Coolidge

cdc_eem frames might need to contain 802.1Q VLAN Ethernet frames. URB/skb sizing from usbnet will default to the hard_mtu, so account for the VLAN header by expanding that via hard_header_len

---
 drivers/net/usb/cdc_eem.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/usb/cdc_eem.c +2 -1
index c81e278..08d55b6 100644
@@ -31,6 +31,7 @@
 #include <linux/usb/cdc.h>
 #include <linux/usb/usbnet.h>
 #include <linux/gfp.h>
+#include <linux/if_vlan.h>
 
 
 /*
@@ -92,7 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	/* no jumbogram (16K) support for now */
 
-	dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
+	dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN + VLAN_HLEN;
 	dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
 
 	return 0;
Signature · 1 line
1.7.6.5
#0 lore raw

v2 cover Fix CDC_EEM with 802.1Q VLAN and 1500 MTU

cdc_eem USB host driver and gadget driver both are broken in 1500 MTU case while using 802.1Q VLANs. In both cases, this is due to the assumption of standard Ethernet frame length.

v2: rebase against Dave Miller's 'net/master' tree

Ian Coolidge (2):
usb: gadget: g_ether: fix frame size check for 802.1Q
net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs

 drivers/net/usb/cdc_eem.c    |    3 ++-
 drivers/usb/gadget/u_ether.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 6 lines
1.7.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH v2 1/2 usb: gadget: g_ether: fix frame size check for 802.1Q

In reply to a message not in the archive

Checking skb->len against ETH_FRAME_LEN assumes a 1514 ethernet frame size. With an 802.1Q VLAN header, ethernet frame length can now be 1518. Validate frame length against that.

---
 drivers/usb/gadget/u_ether.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/gadget/u_ether.c +2 -1
index 6458764..4ec3c0d 100644
@@ -20,6 +20,7 @@
 #include <linux/ctype.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <linux/if_vlan.h>
 
 #include "u_ether.h"
 
@@ -295,7 +296,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req)
 		while (skb2) {
 			if (status < 0
 					|| ETH_HLEN > skb2->len
-					|| skb2->len > ETH_FRAME_LEN) {
+					|| skb2->len > VLAN_ETH_FRAME_LEN) {
 				dev->net->stats.rx_errors++;
 				dev->net->stats.rx_length_errors++;
 				DBG(dev, "rx length %d\n", skb2->len);
Signature · 6 lines
1.7.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive

From: Ian Coolidge <[email protected]>
Date: Wed, 7 Nov 2012 16:39:17 -0800

Quoted 9 lines

cdc_eem USB host driver and gadget driver both are broken in 1500 MTU case while using 802.1Q VLANs. In both cases, this is due to the assumption of standard Ethernet frame length.

v2: rebase against Dave Miller's 'net/master' tree

Ian Coolidge (2):
usb: gadget: g_ether: fix frame size check for 802.1Q
net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Hi,

Quoted 7 lines · David Miller

From: Ian Coolidge <[email protected]>
Date: Wed, 7 Nov 2012 16:39:17 -0800

Quoted 4 lines

cdc_eem USB host driver and gadget driver both are broken in 1500 MTU case while using 802.1Q VLANs. In both cases, this is due to the assumption of standard Ethernet frame length.

Quoted 7 lines
Quoted 5 lines

v2: rebase against Dave Miller's 'net/master' tree

Ian Coolidge (2):
usb: gadget: g_ether: fix frame size check for 802.1Q
net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs

Applied, thanks.

did you take both ? I'd rather you waited for my Ack for anything under drivers/usb/gadget/ so we avoid conflicts later.

cheers

Signature · 1 line
balbi
#7 lore raw
In reply to a message not in the archive

From: Felipe Balbi <[email protected]>
Date: Thu, 8 Nov 2012 15:37:36 +0200

Quoted 12 lines

Hi,

Quoted 9 lines · David Miller

From: Ian Coolidge <[email protected]>
Date: Wed, 7 Nov 2012 16:39:17 -0800

Quoted 6 lines

cdc_eem USB host driver and gadget driver both are broken in 1500 MTU case while using 802.1Q VLANs. In both cases, this is due to the assumption of standard Ethernet frame length.

v2: rebase against Dave Miller's 'net/master' tree

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Ian Coolidge (2):
usb: gadget: g_ether: fix frame size check for 802.1Q
net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs

Applied, thanks.

did you take both ?

Yes.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html