Skip to content

Commit

Permalink
[TUN]: Fix leak in tun_get_user()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Jones authored and David S. Miller committed Mar 12, 2006
1 parent 5357448 commit 8f22757
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8f22757

Please sign in to comment.