staging: gdm724x: check for skb->len in gdm_lte_emulate_arp
authorAndrii Vladyka <tulup@mail.ru>
Wed, 18 Oct 2017 13:23:44 +0000 (16:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2017 12:42:50 +0000 (14:42 +0200)
check for skb->len in gdm_lte_emulate_arp in gdm724x driver

Signed-off-by: Andrii Vladyka <tulup@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_lte.c

index 9ab6ce231f117ed8334c1e00ade1c509b6b190ab..066b14ecc3669c661b65e56ac6ad51603a4fc317 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/uaccess.h>
+#include <linux/errno.h>
 #include <net/ndisc.h>
 
 #include "gdm_lte.h"
@@ -118,6 +119,10 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, u32 nic_type)
        void *mac_header_data;
        u32 mac_header_len;
 
+       /* Check for skb->len, discard if empty */
+       if (skb_in->len == 0)
+               return -ENODATA;
+
        /* Format the mac header so that it can be put to skb */
        if (ntohs(((struct ethhdr *)skb_in->data)->h_proto) == ETH_P_8021Q) {
                memcpy(&vlan_eth, skb_in->data, sizeof(struct vlan_ethhdr));