mirror of https://gitee.com/openkylin/linux.git
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 54f968d6ef
(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>
This commit is contained in:
parent
b9e48de110
commit
3811ae76bc
|
@ -1471,14 +1471,17 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
if (!tun)
|
if (!tun)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
|
|
||||||
if (flags & ~(MSG_DONTWAIT|MSG_TRUNC))
|
if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) {
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
ret = tun_do_read(tun, tfile, iocb, m->msg_iov, total_len,
|
ret = tun_do_read(tun, tfile, iocb, m->msg_iov, total_len,
|
||||||
flags & MSG_DONTWAIT);
|
flags & MSG_DONTWAIT);
|
||||||
if (ret > total_len) {
|
if (ret > total_len) {
|
||||||
m->msg_flags |= MSG_TRUNC;
|
m->msg_flags |= MSG_TRUNC;
|
||||||
ret = flags & MSG_TRUNC ? ret : total_len;
|
ret = flags & MSG_TRUNC ? ret : total_len;
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
tun_put(tun);
|
tun_put(tun);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue