Skip to content

Commit

Permalink
DAOS-16251 dtx: Fix dtx_req_send user-after-free (#15035)
Browse files Browse the repository at this point in the history
In dtx_req_send, since the crt_req_send releases the req reference, din
may have been freed when dereferenced for the DL_CDEBUG call.

Signed-off-by: Li Wei <[email protected]>
Required-githooks: true
  • Loading branch information
liw committed Sep 17, 2024
1 parent a4367a3 commit 93eee27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dtx/dtx_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static int
dtx_req_send(struct dtx_req_rec *drr, daos_epoch_t epoch)
{
struct dtx_req_args *dra = drr->drr_parent;
crt_rpc_t *req;
crt_rpc_t *req = NULL;
crt_endpoint_t tgt_ep;
crt_opcode_t opc;
struct dtx_in *din = NULL;
Expand Down Expand Up @@ -282,12 +282,12 @@ dtx_req_send(struct dtx_req_rec *drr, daos_epoch_t epoch)
}

rc = crt_req_send(req, dtx_req_cb, drr);
/* CAUTION: req and din may have been freed. */
}

DL_CDEBUG(rc != 0, DLOG_ERR, DB_TRACE, rc,
"DTX req for opc %x to %d/%d (req %p future %p) sent epoch "DF_X64,
dra->dra_opc, drr->drr_rank, drr->drr_tag, req, dra->dra_future,
din != NULL ? din->di_epoch : 0);
dra->dra_opc, drr->drr_rank, drr->drr_tag, req, dra->dra_future, epoch);

if (rc != 0 && drr->drr_comp == 0) {
drr->drr_comp = 1;
Expand Down

0 comments on commit 93eee27

Please sign in to comment.