summaryrefslogtreecommitdiffstats
path: root/net/smc/smc_cdc.c
diff options
context:
space:
mode:
authorKarsten Graul <kgraul@linux.ibm.com>2020-07-20 16:24:28 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-21 02:52:25 +0200
commit2bced6aefa3d0347e11efc610759e1317bfca7a7 (patch)
treec5e444b1b5fe332f5ad79a8a4e066fb8fcd8e44a /net/smc/smc_cdc.c
parentrxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA (diff)
downloadlinux-2bced6aefa3d0347e11efc610759e1317bfca7a7.tar.xz
linux-2bced6aefa3d0347e11efc610759e1317bfca7a7.zip
net/smc: put slot when connection is killed
To get a send slot smc_wr_tx_get_free_slot() is called, which might wait for a free slot. When smc_wr_tx_get_free_slot() returns there is a check if the connection was killed in the meantime. In that case don't only return an error, but also put back the free slot. Fixes: b290098092e4 ("net/smc: cancel send and receive for terminated socket") Reviewed-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_cdc.c')
-rw-r--r--net/smc/smc_cdc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index a47e8855e045..ce468ff62a19 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -66,9 +66,13 @@ int smc_cdc_get_free_slot(struct smc_connection *conn,
rc = smc_wr_tx_get_free_slot(link, smc_cdc_tx_handler, wr_buf,
wr_rdma_buf,
(struct smc_wr_tx_pend_priv **)pend);
- if (conn->killed)
+ if (conn->killed) {
/* abnormal termination */
+ if (!rc)
+ smc_wr_tx_put_slot(link,
+ (struct smc_wr_tx_pend_priv *)pend);
rc = -EPIPE;
+ }
return rc;
}