[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200804052154.33636.rusty@rustcorp.com.au>
Date: Sat, 5 Apr 2008 21:54:33 +1000
From: Rusty Russell <rusty@...tcorp.com.au>
To: David Miller <davem@...emloft.net>
Cc: Max Krasnyansky <maxk@...lcomm.com>, netdev@...r.kernel.org
Subject: [PATCH 2/2] 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: Rusty Russell <rusty@...tcorp.com.au>
diff -r 99132ad16999 drivers/net/tun.c
--- a/drivers/net/tun.c Sat Apr 05 21:20:32 2008 +1100
+++ b/drivers/net/tun.c Sat Apr 05 22:47:20 2008 +1100
@@ -286,8 +286,11 @@ static __inline__ ssize_t tun_get_user(s
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++;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists