Skip to content

Commit

Permalink
[PCRF] Fixed a crash (#1981)
Browse files Browse the repository at this point in the history
An assertion was fired when switching between video and audio.
  • Loading branch information
acetcom committed Jan 7, 2023
1 parent 4510176 commit 2ec1f48
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/pcrf/pcrf-gx-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp,
next_rx_sess_data, rx_sess_data) {
rv = pcrf_rx_send_asr(
rx_sess_data->sid, OGS_DIAM_RX_ABORT_CAUSE_BEARER_RELEASED);
ogs_assert(rv == OGS_OK);
ogs_expect(rv == OGS_OK);

remove_rx_state(rx_sess_data);
}
Expand Down
31 changes: 19 additions & 12 deletions src/pcrf/pcrf-rx-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ int pcrf_rx_send_asr(uint8_t *rx_sid, uint32_t abort_cause)

ogs_debug("[PCRF] Abort-Session-Request");

/* Retrieve session by Session-Id */
sidlen = strlen((char *)rx_sid);
ret = fd_sess_fromsid_msg((os0_t)(rx_sid), sidlen, &session, &new);
ogs_assert(ret == 0);
if (new) {
ogs_error("Cannot find Rx Session [ID:%s Cause:%d]",
rx_sid, abort_cause);
return OGS_ERROR;
}

/* Create the request */
ret = fd_msg_new(ogs_diam_rx_cmd_asr, MSGFL_ALLOC_ETEID, &req);
ogs_assert(ret == 0);
Expand All @@ -436,12 +446,6 @@ int pcrf_rx_send_asr(uint8_t *rx_sid, uint32_t abort_cause)
h->msg_appl = OGS_DIAM_RX_APPLICATION_ID;
}

/* Retrieve session by Session-Id */
sidlen = strlen((char *)rx_sid);
ret = fd_sess_fromsid_msg((os0_t)(rx_sid), sidlen, &session, &new);
ogs_assert(ret == 0);
ogs_assert(new == 0);

/* Add Session-Id to the message */
ret = ogs_diam_message_session_id_set(req, (os0_t)(rx_sid), sidlen);
ogs_assert(ret == 0);
Expand Down Expand Up @@ -618,12 +622,6 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp,
ogs_assert(msg);
ogs_assert(sess);

ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data);
ogs_assert(ret == 0);
ogs_assert(sess_data);
ogs_assert(sess_data->rx_sid);
ogs_assert(sess_data->gx_sid);

/* Initialize Message */
memset(&rx_message, 0, sizeof(ogs_diam_rx_message_t));
rx_message.cmd_code = OGS_DIAM_RX_CMD_CODE_SESSION_TERMINATION;
Expand Down Expand Up @@ -652,6 +650,15 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp,
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
ogs_assert(ret == 0);

ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data);
ogs_assert(ret == 0);
if (!sess_data) {
ogs_error("Cannot find session in Session-Termination-Request");
goto out;
}
ogs_assert(sess_data->rx_sid);
ogs_assert(sess_data->gx_sid);

/* Get Termination-Cause */
ret = fd_msg_search_avp(qry, ogs_diam_termination_cause, &avp);
ogs_assert(ret == 0);
Expand Down

0 comments on commit 2ec1f48

Please sign in to comment.