Skip to content

Commit b02d8c4

Browse files
committed
usnic: make the releasing safer
Since the usnic BTL is single-threaded in this area, there really is no danger, but don't use one of the pointers hanging off the frag after we return it to the freelist. Instead, save the endpoint pointer before returning the frag. Signed-off-by: Jeff Squyres <[email protected]>
1 parent e25b860 commit b02d8c4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

opal/mca/btl/usnic/btl_usnic_send.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ opal_btl_usnic_frag_send_complete(opal_btl_usnic_module_t *module,
6060
--frag->sf_seg_post_cnt;
6161

6262
/* checks for returnability made inside */
63+
opal_btl_usnic_endpoint_t *ep = frag->sf_endpoint;
6364
opal_btl_usnic_send_frag_return_cond(module, frag);
6465

66+
// In a short frag segment, the sseg is embedded in the frag. So
67+
// there's no need to return the sseg (because we already returned
68+
// the frag).
69+
6570
/* do bookkeeping */
66-
++frag->sf_endpoint->endpoint_send_credits;
71+
++ep->endpoint_send_credits;
6772

6873
/* see if this endpoint needs to be made ready-to-send */
69-
opal_btl_usnic_check_rts(frag->sf_endpoint);
74+
opal_btl_usnic_check_rts(ep);
7075

7176
++module->mod_channels[sseg->ss_channel].credits;
7277
}

0 commit comments

Comments
 (0)