summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/u_ether.c
diff options
context:
space:
mode:
authorIan Coolidge <iancoolidge@gmail.com>2012-11-07 14:39:18 +0000
committerDavid S. Miller <davem@davemloft.net>2012-11-07 21:12:26 -0500
commit4fe5f079b499d7ff34fd49f4005f09018c4e80aa (patch)
treecba08a1fc3ce038f5eea1b72b9a252bdb49095e1 /drivers/usb/gadget/u_ether.c
parent0dad9e94bdb1e424c4feeed715dff2fe51528289 (diff)
downloadlwn-4fe5f079b499d7ff34fd49f4005f09018c4e80aa.tar.gz
lwn-4fe5f079b499d7ff34fd49f4005f09018c4e80aa.zip
usb: gadget: g_ether: fix frame size check for 802.1Q
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. Signed-off-by: Ian Coolidge <iancoolidge@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/gadget/u_ether.c')
-rw-r--r--drivers/usb/gadget/u_ether.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 6458764994ef..4ec3c0d7a18b 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -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);