rua: Fix null ptr access in hnb->llsk.srv

At startup, osmo-hnodeb connects the Iuh socket to the HNBGW, and start
the LLSK unix socket link_server waiting for lower layers to connect.
If for some reason the lower layers don't connect and an Iuh messages
arrives which was to be forwarded to LLSK, it would try to access it
without first checking if it was already available.
This patch adds a check to avoid a crash when accessing the null
pointer.

Change-Id: I32d8f91b2fc5401ace386e1085c248476228cd18
This commit is contained in:
Pau Espin 2023-07-25 11:27:57 +02:00
parent 4d94531f6f
commit 69682c8deb
1 changed files with 5 additions and 0 deletions

View File

@ -115,6 +115,11 @@ static void hnb_rua_cl_handle(struct hnb *hnb, ANY_t *in)
ranap_buf_len = ies.ranaP_Message.size;
LOGP(DRUA, LOGL_DEBUG, "Rx RUA UDT ranap_len=%zu\n", ranap_buf_len);
if (!hnb->llsk.srv) {
LOGP(DRUA, LOGL_NOTICE, "Discarding rx RUA UDT ranap_len=%zu due to lower layers not available\n",
ranap_buf_len);
goto free_ret;
}
LOGP(DLLSK, LOGL_DEBUG, "Tx IUH-UNITDATA.ind ranap_len=%zu\n", ranap_buf_len);
iuh_prim = hnb_iuh_makeprim_unitdata_ind(ranap_buf, ranap_buf_len);