[SMF] Prevent SMF crash on closed or invalid HTTP/2 streams (#3978)

During PDU Session release, under memory pressure or upon receiving
an RST_STREAM, the SMF could still attempt to process an already-closed
HTTP/2 stream. This led to a fatal assert(stream) in smf_state_operational(),
terminating the entire SMF process even though the error affected
only a single UE context.

This commit adds a null check for the stream before sending the HTTP status.
If the stream has already been removed, SMF now logs an error instead of
asserting.
This commit is contained in:
Sukchan Lee
2025-07-09 22:03:35 +09:00
parent f47f2bd4f7
commit f168f7586a

View File

@@ -951,9 +951,14 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_assert(true == ogs_sbi_send_http_status_no_content(stream));
} else if (state == SMF_UECM_STATE_DEREGISTERED_BY_AMF) {
/* SMF Deregistration */
ogs_assert(stream);
ogs_assert(true == ogs_sbi_send_http_status_no_content(stream));
if (stream)
ogs_assert(true ==
ogs_sbi_send_http_status_no_content(stream));
else
ogs_error("Stream has already been removed");
SMF_SESS_CLEAR(sess);
} else if (state == SMF_UECM_STATE_DEREGISTERED_BY_N1_N2_RELEASE) {
/* SMF Deregistration */
ogs_assert(true == smf_sbi_send_sm_context_status_notify(sess));