diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2019-10-10 04:16:10 -0400 |
---|---|---|
committer | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-10-10 22:08:41 -0400 |
commit | 882dcfe5a1785c20f45820cbe6fec4b8b647c946 (patch) | |
tree | 7f11be8258d79a3d48af2953b66eb796e2d3651b /net | |
parent | 29ee2701529e1905c0e948688f9688c68c8d4ea4 (diff) |
net/smc: receive returns without data
smc_cdc_rxed_any_close_or_senddone() is used as an end condition for the
receive loop. This conflicts with smc_cdc_msg_recv_action() which could
run in parallel and set the bits checked by
smc_cdc_rxed_any_close_or_senddone() before the receive is processed.
In that case we could return from receive with no data, although data is
available. The same applies to smc_rx_wait().
Fix this by checking for RCV_SHUTDOWN only, which is set in
smc_cdc_msg_recv_action() after the receive was actually processed.
Fixes: 952310ccf2d8 ("smc: receive data from RMBE")
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/smc_rx.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c index 413a6abf227e..000002642288 100644 --- a/net/smc/smc_rx.c +++ b/net/smc/smc_rx.c | |||
@@ -211,8 +211,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, | |||
211 | rc = sk_wait_event(sk, timeo, | 211 | rc = sk_wait_event(sk, timeo, |
212 | sk->sk_err || | 212 | sk->sk_err || |
213 | sk->sk_shutdown & RCV_SHUTDOWN || | 213 | sk->sk_shutdown & RCV_SHUTDOWN || |
214 | fcrit(conn) || | 214 | fcrit(conn), |
215 | smc_cdc_rxed_any_close_or_senddone(conn), | ||
216 | &wait); | 215 | &wait); |
217 | remove_wait_queue(sk_sleep(sk), &wait); | 216 | remove_wait_queue(sk_sleep(sk), &wait); |
218 | sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); | 217 | sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
@@ -310,7 +309,6 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, | |||
310 | smc_rx_update_cons(smc, 0); | 309 | smc_rx_update_cons(smc, 0); |
311 | 310 | ||
312 | if (sk->sk_shutdown & RCV_SHUTDOWN || | 311 | if (sk->sk_shutdown & RCV_SHUTDOWN || |
313 | smc_cdc_rxed_any_close_or_senddone(conn) || | ||
314 | conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) | 312 | conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) |
315 | break; | 313 | break; |
316 | 314 | ||