提交 e01bf1c8 编写于 作者: R Rusty Russell 提交者: David S. Miller

net: check for underlength tap writes

If the user gives a packet under 14 bytes, we'll end up reading off the end
of the skb (not oopsing, just reading off the end).
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
Acked-by: NMax Krasnyanskiy <maxk@qualcomm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 14daa021
......@@ -286,8 +286,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
return -EFAULT;
}
if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV)
if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
align = NET_IP_ALIGN;
if (unlikely(len < ETH_HLEN))
return -EINVAL;
}
if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
tun->dev->stats.rx_dropped++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册