summaryrefslogtreecommitdiff
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorAlex Gartrell <agartrell@fb.com>2014-12-26 10:22:49 +0300
committerDavid S. Miller <davem@davemloft.net>2014-12-31 22:14:54 +0300
commit957f094f221f81e457133b1f4c4d95ffa49ff731 (patch)
tree874c464154b76e2088a98a3f189c9592e2933dfe /drivers/net/tun.c
parent87897931c83038af4931990af5b9365b41829921 (diff)
downloadlinux-957f094f221f81e457133b1f4c4d95ffa49ff731.tar.xz
tun: return proper error code from tun_do_read
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>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index df5e94871844..c0df872f5b8c 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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))