diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-14 10:56:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-14 10:56:24 -0400 |
commit | 533bb8a4d7388686243c37a414c4448ba3566f8a (patch) | |
tree | 506ef946871e4499862ecc8513f49b69389ae865 /drivers/net/tun.c | |
parent | 4f3f8e94b7b079131f0faf641e8afd790a6537d1 (diff) | |
parent | 159d83363b629c91d020734207c1bc788b96af5a (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (31 commits)
[BRIDGE]: Fix crash in __ip_route_output_key with bridge netfilter
[NETFILTER]: ipt_CLUSTERIP: fix race between clusterip_config_find_get and _entry_put
[IPV6] ADDRCONF: Don't generate temporary address for ip6-ip6 interface.
[IPV6] ADDRCONF: Ensure disabling multicast RS even if privacy extensions are disabled.
[IPV6]: Use appropriate sock tclass setting for routing lookup.
[IPV6]: IPv6 extension header structures need to be packed.
[IPV6]: Fix ipv6 address fetching in raw6_icmp_error().
[NET]: Return more appropriate error from eth_validate_addr().
[ISDN]: Do not validate ISDN net device address prior to interface-up
[NET]: Fix kernel-doc for skb_segment
[SOCK] sk_stamp: should be initialized to ktime_set(-1L, 0)
net: check for underlength tap writes
net: make struct tun_struct private to tun.c
[SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event.
[SCTP]: Fix compiler warning about const qualifiers
[SCTP]: Fix protocol violation when receiving an error lenght INIT-ACK
[SCTP]: Add check for hmac_algo parameter in sctp_verify_param()
[NET_SCHED] cls_u32: refcounting fix for u32_delete()
[DCCP]: Fix skb->cb conflicts with IP
[AX25]: Potential ax25_uid_assoc-s leaks on module unload.
...
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 7b816a032957..5b5d87585d91 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -67,9 +67,42 @@ | |||
67 | #include <asm/system.h> | 67 | #include <asm/system.h> |
68 | #include <asm/uaccess.h> | 68 | #include <asm/uaccess.h> |
69 | 69 | ||
70 | /* Uncomment to enable debugging */ | ||
71 | /* #define TUN_DEBUG 1 */ | ||
72 | |||
70 | #ifdef TUN_DEBUG | 73 | #ifdef TUN_DEBUG |
71 | static int debug; | 74 | static int debug; |
75 | |||
76 | #define DBG if(tun->debug)printk | ||
77 | #define DBG1 if(debug==2)printk | ||
78 | #else | ||
79 | #define DBG( a... ) | ||
80 | #define DBG1( a... ) | ||
81 | #endif | ||
82 | |||
83 | struct tun_struct { | ||
84 | struct list_head list; | ||
85 | unsigned long flags; | ||
86 | int attached; | ||
87 | uid_t owner; | ||
88 | gid_t group; | ||
89 | |||
90 | wait_queue_head_t read_wait; | ||
91 | struct sk_buff_head readq; | ||
92 | |||
93 | struct net_device *dev; | ||
94 | |||
95 | struct fasync_struct *fasync; | ||
96 | |||
97 | unsigned long if_flags; | ||
98 | u8 dev_addr[ETH_ALEN]; | ||
99 | u32 chr_filter[2]; | ||
100 | u32 net_filter[2]; | ||
101 | |||
102 | #ifdef TUN_DEBUG | ||
103 | int debug; | ||
72 | #endif | 104 | #endif |
105 | }; | ||
73 | 106 | ||
74 | /* Network device part of the driver */ | 107 | /* Network device part of the driver */ |
75 | 108 | ||
@@ -253,8 +286,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
253 | return -EFAULT; | 286 | return -EFAULT; |
254 | } | 287 | } |
255 | 288 | ||
256 | if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) | 289 | if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { |
257 | align = NET_IP_ALIGN; | 290 | align = NET_IP_ALIGN; |
291 | if (unlikely(len < ETH_HLEN)) | ||
292 | return -EINVAL; | ||
293 | } | ||
258 | 294 | ||
259 | if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { | 295 | if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { |
260 | tun->dev->stats.rx_dropped++; | 296 | tun->dev->stats.rx_dropped++; |