diff options
author | Alex Gartrell <agartrell@fb.com> | 2014-12-25 23:22:49 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-29 10:23:41 +0200 |
commit | 6e24551ff94701e62c13c982eca0bc3a682817ad (patch) | |
tree | 1029893bbf61e0a178e0a880b3e483fdc5c6559b /drivers | |
parent | 553ecf745589a74d4195e6019a026c15b5048c58 (diff) |
tun: return proper error code from tun_do_read
[ Upstream commit 957f094f221f81e457133b1f4c4d95ffa49ff731 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-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 10f9e4021b5a..9a409a8f3b19 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1368,7 +1368,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)) |