Skip to content

Commit db145b8

Browse files
Wen Gugregkh
authored andcommitted
net/smc: Stop the CLC flow if no link to map buffers on
[ Upstream commit e738455 ] There might be a potential race between SMC-R buffer map and link group termination. smc_smcr_terminate_all() | smc_connect_rdma() -------------------------------------------------------------- | smc_conn_create() for links in smcibdev | schedule links down | | smc_buf_create() | \- smcr_buf_map_usable_links() | \- no usable links found, | (rmb->mr = NULL) | | smc_clc_send_confirm() | \- access conn->rmb_desc->mr[]->rkey | (panic) During reboot and IB device module remove, all links will be set down and no usable links remain in link groups. In such situation smcr_buf_map_usable_links() should return an error and stop the CLC flow accessing to uninitialized mr. Fixes: b924754 ("net/smc: convert static link ID instances to support multiple links") Signed-off-by: Wen Gu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 5daef00 commit db145b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/smc/smc_core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr,
19801980
static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
19811981
struct smc_buf_desc *buf_desc, bool is_rmb)
19821982
{
1983-
int i, rc = 0;
1983+
int i, rc = 0, cnt = 0;
19841984

19851985
/* protect against parallel link reconfiguration */
19861986
mutex_lock(&lgr->llc_conf_mutex);
@@ -1993,9 +1993,12 @@ static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
19931993
rc = -ENOMEM;
19941994
goto out;
19951995
}
1996+
cnt++;
19961997
}
19971998
out:
19981999
mutex_unlock(&lgr->llc_conf_mutex);
2000+
if (!rc && !cnt)
2001+
rc = -EINVAL;
19992002
return rc;
20002003
}
20012004

0 commit comments

Comments
 (0)