diff options
-rw-r--r-- | drivers/net/tun.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 970ec4793442..5b5d87585d91 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -286,8 +286,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
286 | return -EFAULT; | 286 | return -EFAULT; |
287 | } | 287 | } |
288 | 288 | ||
289 | if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) | 289 | if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { |
290 | align = NET_IP_ALIGN; | 290 | align = NET_IP_ALIGN; |
291 | if (unlikely(len < ETH_HLEN)) | ||
292 | return -EINVAL; | ||
293 | } | ||
291 | 294 | ||
292 | if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { | 295 | if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { |
293 | tun->dev->stats.rx_dropped++; | 296 | tun->dev->stats.rx_dropped++; |