Skip to content

Commit

Permalink
tun: return proper error code from tun_do_read
Browse files Browse the repository at this point in the history
Instead of -1 with EAGAIN, read on a O_NONBLOCK tun fd will return 0.  This
fixes this by properly returning the error code from __skb_recv_datagram.

Signed-off-by: Alex Gartrell <agartrell@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alex Gartrell authored and davem330 committed Dec 31, 2014
1 parent 8789793 commit 957f094
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0,
&peeked, &off, &err);
if (!skb)
return 0;
return err;

ret = tun_put_user(tun, tfile, skb, to);
if (unlikely(ret < 0))
Expand Down

0 comments on commit 957f094

Please sign in to comment.