Skip to content

Commit 49ec2fa

Browse files
shijin-awssunkuamzn
authored andcommitted
fabtests/efa: Fix the av operation
Currently, open_client uses an intermediate ptr av to stage the value of avs array element, and only open av for that av ptr only. However, this av is not tracked after the function returns and become a wild pointer. This patch fixes this issue by operating on the avs array directly so it can be cleaned up properly during the free functions Signed-off-by: Shi Jin <[email protected]>
1 parent 6e4645d commit 49ec2fa

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fabtests/prov/efa/src/multi_ep_mt.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ int open_client(int idx)
368368
{
369369
int ret;
370370
struct fi_av_attr av_attr = {0};
371-
struct fid_av *av;
371+
int av_idx = idx;
372372

373373
if (opts.av_name) {
374374
av_attr.name = opts.av_name;
@@ -383,11 +383,9 @@ int open_client(int idx)
383383

384384
/* ft_enable_ep bind the ep with cq and av before enabling */
385385
if (shared_av) {
386-
av = avs[0];
386+
av_idx = 0;
387387
} else {
388-
av = avs[idx];
389-
390-
ret = fi_av_open(domain, &av_attr, &av, NULL);
388+
ret = fi_av_open(domain, &av_attr, &avs[av_idx], NULL);
391389
if (ret) {
392390
FT_PRINTERR("fi_av_open", ret);
393391
return ret;
@@ -399,7 +397,7 @@ int open_client(int idx)
399397
return ret;
400398

401399
/* Use the same remote addr we got from the persistent receiver ep */
402-
ret = ft_av_insert(av, (void *)remote_raw_addr, 1, &remote_fiaddr[idx], 0, NULL);
400+
ret = ft_av_insert(avs[av_idx], (void *)remote_raw_addr, 1, &remote_fiaddr[idx], 0, NULL);
403401
if (ret)
404402
return ret;
405403

0 commit comments

Comments
 (0)