Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932882AbbDZOTZ (ORCPT ); Sun, 26 Apr 2015 10:19:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41202 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964791AbbDZOQz (ORCPT ); Sun, 26 Apr 2015 10:16:55 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Gartrell , "David S. Miller" Subject: [PATCH 3.19 05/27] tun: return proper error code from tun_do_read Date: Sun, 26 Apr 2015 16:15:36 +0200 Message-Id: <20150426134603.591323590@linuxfoundation.org> X-Mailer: git-send-email 2.3.6 In-Reply-To: <20150426134603.371719585@linuxfoundation.org> References: <20150426134603.371719585@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1167 Lines: 36 3.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Gartrell [ 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1368,7 +1368,7 @@ static ssize_t tun_do_read(struct tun_st 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)) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/