Skip to content

Commit e738455

Browse files
Wen GuPaolo Abeni
authored andcommitted
net/smc: Stop the CLC flow if no link to map buffers on
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]>
1 parent 624aea6 commit e738455

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
@@ -2239,7 +2239,7 @@ static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr,
22392239
static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
22402240
struct smc_buf_desc *buf_desc, bool is_rmb)
22412241
{
2242-
int i, rc = 0;
2242+
int i, rc = 0, cnt = 0;
22432243

22442244
/* protect against parallel link reconfiguration */
22452245
mutex_lock(&lgr->llc_conf_mutex);
@@ -2252,9 +2252,12 @@ static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
22522252
rc = -ENOMEM;
22532253
goto out;
22542254
}
2255+
cnt++;
22552256
}
22562257
out:
22572258
mutex_unlock(&lgr->llc_conf_mutex);
2259+
if (!rc && !cnt)
2260+
rc = -EINVAL;
22582261
return rc;
22592262
}
22602263

0 commit comments

Comments
 (0)