提交 3811ae76 编写于 作者: G Gao feng 提交者: David S. Miller

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 54f968d6
(tuntap: move socket to tun_file)
Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
Acked-by: NJason Wang <jasowang@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b9e48de1
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册