summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Wythe <alibuda@linux.alibaba.com>2023-11-03 14:07:39 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 11:06:56 +0100
commitf652ab15af0a05b7d1a413096d2bb40b6b1c86c9 (patch)
treed80cab54c863bb7e48dd92b09d512bf59b94945a
parent4e7bad7301601290bfd3a60ddb6605e2d7b80dd6 (diff)
downloadlinux-stable-f652ab15af0a05b7d1a413096d2bb40b6b1c86c9.tar.gz
linux-stable-f652ab15af0a05b7d1a413096d2bb40b6b1c86c9.tar.bz2
linux-stable-f652ab15af0a05b7d1a413096d2bb40b6b1c86c9.zip
net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc
[ Upstream commit c5bf605ba4f9d6fbbb120595ab95002f4716edcb ] This patch re-fix the issues mentioned by commit 22a825c541d7 ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()"). Blocking sending message do solve the issues though, but it also prevents the peer to receive the final message. Besides, in logic, whether the sndbuf_desc is NULL or not have no impact on the processing of cdc message sending. Hence that, this patch allows the cdc message sending but to check the sndbuf_desc with care in smc_cdc_tx_handler(). Fixes: 22a825c541d7 ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()") Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/smc/smc_cdc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index 78c212a7f617..b92b2cee2079 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd,
{
struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd;
struct smc_connection *conn = cdcpend->conn;
+ struct smc_buf_desc *sndbuf_desc;
struct smc_sock *smc;
int diff;
+ sndbuf_desc = conn->sndbuf_desc;
smc = container_of(conn, struct smc_sock, conn);
bh_lock_sock(&smc->sk);
- if (!wc_status) {
- diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len,
+ if (!wc_status && sndbuf_desc) {
+ diff = smc_curs_diff(sndbuf_desc->len,
&cdcpend->conn->tx_curs_fin,
&cdcpend->cursor);
/* sndbuf_space is decreased in smc_sendmsg */
@@ -104,9 +106,6 @@ int smc_cdc_msg_send(struct smc_connection *conn,
union smc_host_cursor cfed;
int rc;
- if (unlikely(!READ_ONCE(conn->sndbuf_desc)))
- return -ENOBUFS;
-
smc_cdc_add_pending_send(conn, pend);
conn->tx_cdc_seq++;