summaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-04-24 23:59:23 +0200
committerDavid S. Miller <davem@davemloft.net>2013-04-29 17:06:37 +0200
commit3811ae76bc84e5dc1a670ae10695f046b310bee1 (patch)
tree68e4d8aaa9b4953183141a619be3a3786fdec107 /drivers/net/tun.c
parentisdn/sc: Fix incorrect module_param_array types (diff)
downloadlinux-3811ae76bc84e5dc1a670ae10695f046b310bee1.tar.xz
linux-3811ae76bc84e5dc1a670ae10695f046b310bee1.zip
net: tun: release the reference of tun device in tun_recvmsg
We forget to release the reference of tun device in tun_recvmsg. bug introduced in commit 54f968d6efdbf7dec36faa44fc11f01b0e4d1990 (tuntap: move socket to tun_file) Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 0c9df2fe8f05..dcd0c19a431e 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1471,14 +1471,17 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
if (!tun)
return -EBADFD;
- if (flags & ~(MSG_DONTWAIT|MSG_TRUNC))
- return -EINVAL;
+ if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) {
+ ret = -EINVAL;
+ goto out;
+ }
ret = tun_do_read(tun, tfile, iocb, m->msg_iov, total_len,
flags & MSG_DONTWAIT);
if (ret > total_len) {
m->msg_flags |= MSG_TRUNC;
ret = flags & MSG_TRUNC ? ret : total_len;
}
+out:
tun_put(tun);
return ret;
}