* [PATCH net-next] tun: return proper error code from tun_do_read
@ 2014-12-26 7:22 Alex Gartrell
2014-12-31 19:15 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Alex Gartrell @ 2014-12-26 7:22 UTC (permalink / raw)
To: davem, herbert; +Cc: netdev, linux-kernel, kernel-team, Alex Gartrell
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>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a5cbf67..2f65d6c 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1378,7 +1378,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))
--
Alex Gartrell <agartrell@fb.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] tun: return proper error code from tun_do_read
2014-12-26 7:22 [PATCH net-next] tun: return proper error code from tun_do_read Alex Gartrell
@ 2014-12-31 19:15 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-12-31 19:15 UTC (permalink / raw)
To: agartrell; +Cc: herbert, netdev, linux-kernel, kernel-team
From: Alex Gartrell <agartrell@fb.com>
Date: Thu, 25 Dec 2014 23:22:49 -0800
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-31 19:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 7:22 [PATCH net-next] tun: return proper error code from tun_do_read Alex Gartrell
2014-12-31 19:15 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).