net/smc: add receive timeout check
authorHans Wippel <hwippel@linux.vnet.ibm.com>
Thu, 21 Sep 2017 07:16:27 +0000 (09:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Sep 2017 22:31:02 +0000 (15:31 -0700)
The SMC receive function currently lacks a timeout check under the
condition that no data were received and no data are available. This
patch adds such a check.

Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_rx.c

index b17a333e9bb0733893d9e44d92fc7ddf2f75ffbf..3e631ae4b6b65f1ac9f32e5a22d6fdc5b294519f 100644 (file)
@@ -148,6 +148,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, size_t len,
                                read_done = sock_intr_errno(timeo);
                                break;
                        }
+                       if (!timeo)
+                               return -EAGAIN;
                }
 
                if (!atomic_read(&conn->bytes_to_rcv)) {