check for skb->len in gdm_lte_emulate_arp

Signed-off-by: Andrii Vladyka <tu...@mail.ru>
---
 drivers/staging/gdm724x/gdm_lte.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 9ab6ce2..42fcf9b 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -27,6 +27,7 @@
 #include <linux/icmpv6.h>
 #include <linux/uaccess.h>
 #include <net/ndisc.h>
+#include <uapi/asm-generic/errno.h>
 
 #include "gdm_lte.h"
 #include "netlink_k.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));
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to