Skip to content

Commit

Permalink
net: tun: release the reference of tun device in tun_recvmsg
Browse files Browse the repository at this point in the history
We forget to release the reference of tun device in tun_recvmsg.
bug introduced in commit 54f968d
(tuntap: move socket to tun_file)

Signed-off-by: Gao feng <[email protected]>
Acked-by: Jason Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Gao feng authored and davem330 committed Apr 29, 2013
1 parent b9e48de commit 3811ae7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3811ae7

Please sign in to comment.