Johannes Thumshirn 5a2d70
From: Hans Wippel <hwippel@linux.vnet.ibm.com>
Johannes Thumshirn 5a2d70
Date: Thu, 21 Sep 2017 09:16:27 +0200
Johannes Thumshirn 5a2d70
Subject: net/smc: add receive timeout check
Johannes Thumshirn 5a2d70
Patch-mainline: v4.14-rc2
Johannes Thumshirn 5a2d70
Git-commit: 846e344eb7229018457d6d6fc1ab0cc0a167692f
Johannes Thumshirn 5a2d70
References: bsc#1096003, FATE#325023, LTC#164003
Johannes Thumshirn 5a2d70
Johannes Thumshirn 5a2d70
The SMC receive function currently lacks a timeout check under the
Johannes Thumshirn 5a2d70
condition that no data were received and no data are available. This
Johannes Thumshirn 5a2d70
patch adds such a check.
Johannes Thumshirn 5a2d70
Johannes Thumshirn 5a2d70
Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Johannes Thumshirn 5a2d70
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Johannes Thumshirn 5a2d70
Signed-off-by: David S. Miller <davem@davemloft.net>
Johannes Thumshirn 5a2d70
Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
Johannes Thumshirn 5a2d70
---
Johannes Thumshirn 5a2d70
 net/smc/smc_rx.c | 2 ++
Johannes Thumshirn 5a2d70
 1 file changed, 2 insertions(+)
Johannes Thumshirn 5a2d70
Johannes Thumshirn 5a2d70
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
Johannes Thumshirn 5a2d70
index b17a333e9bb0..3e631ae4b6b6 100644
Johannes Thumshirn 5a2d70
--- a/net/smc/smc_rx.c
Johannes Thumshirn 5a2d70
+++ b/net/smc/smc_rx.c
Johannes Thumshirn 5a2d70
@@ -148,6 +148,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, size_t len,
Johannes Thumshirn 5a2d70
 				read_done = sock_intr_errno(timeo);
Johannes Thumshirn 5a2d70
 				break;
Johannes Thumshirn 5a2d70
 			}
Johannes Thumshirn 5a2d70
+			if (!timeo)
Johannes Thumshirn 5a2d70
+				return -EAGAIN;
Johannes Thumshirn 5a2d70
 		}
Johannes Thumshirn 5a2d70
 
Johannes Thumshirn 5a2d70
 		if (!atomic_read(&conn->bytes_to_rcv)) {
Johannes Thumshirn 5a2d70