mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
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>
This commit is contained in:
parent
0dad9e94bd
commit
4fe5f079b4
1 changed files with 2 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/etherdevice.h>
|
#include <linux/etherdevice.h>
|
||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
|
#include <linux/if_vlan.h>
|
||||||
|
|
||||||
#include "u_ether.h"
|
#include "u_ether.h"
|
||||||
|
|
||||||
|
@ -295,7 +296,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req)
|
||||||
while (skb2) {
|
while (skb2) {
|
||||||
if (status < 0
|
if (status < 0
|
||||||
|| ETH_HLEN > skb2->len
|
|| ETH_HLEN > skb2->len
|
||||||
|| skb2->len > ETH_FRAME_LEN) {
|
|| skb2->len > VLAN_ETH_FRAME_LEN) {
|
||||||
dev->net->stats.rx_errors++;
|
dev->net->stats.rx_errors++;
|
||||||
dev->net->stats.rx_length_errors++;
|
dev->net->stats.rx_length_errors++;
|
||||||
DBG(dev, "rx length %d\n", skb2->len);
|
DBG(dev, "rx length %d\n", skb2->len);
|
||||||
|
|
Loading…
Reference in a new issue