diff options
author | Alex Gartrell <agartrell@fb.com> | 2014-12-26 02:22:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-31 14:14:54 -0500 |
commit | 957f094f221f81e457133b1f4c4d95ffa49ff731 (patch) | |
tree | 874c464154b76e2088a98a3f189c9592e2933dfe /drivers/net/tun.c | |
parent | 87897931c83038af4931990af5b9365b41829921 (diff) |
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.c | 2 |
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, | |||
1380 | skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, | 1380 | skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, |
1381 | &peeked, &off, &err); | 1381 | &peeked, &off, &err); |
1382 | if (!skb) | 1382 | if (!skb) |
1383 | return 0; | 1383 | return err; |
1384 | 1384 | ||
1385 | ret = tun_put_user(tun, tfile, skb, to); | 1385 | ret = tun_put_user(tun, tfile, skb, to); |
1386 | if (unlikely(ret < 0)) | 1386 | if (unlikely(ret < 0)) |