diff options
author | Dave Jones <davej@redhat.com> | 2006-03-12 03:49:13 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-12 03:49:13 +0100 |
commit | 8f22757ee84da64d4f662f1dd03dae95358a1efe (patch) | |
tree | ebbf96d3c733c5cad9ab002740f1d4b829e07a4e /drivers/net/tun.c | |
parent | Linux 2.6.16-rc6 (diff) | |
download | linux-8f22757ee84da64d4f662f1dd03dae95358a1efe.tar.xz linux-8f22757ee84da64d4f662f1dd03dae95358a1efe.zip |
[TUN]: Fix leak in tun_get_user()
We're leaking an skb in a failure path in this function.
Coverity #632
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-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 50b8c6754b1e..a1ed2d983740 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -249,8 +249,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, if (align) skb_reserve(skb, align); - if (memcpy_fromiovec(skb_put(skb, len), iv, len)) + if (memcpy_fromiovec(skb_put(skb, len), iv, len)) { + tun->stats.rx_dropped++; + kfree_skb(skb); return -EFAULT; + } skb->dev = tun->dev; switch (tun->flags & TUN_TYPE_MASK) { |