pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/33917 )
Change subject: rua: Fix null ptr access in hnb->llsk.srv ......................................................................
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 --- M src/osmo-hnodeb/rua.c 1 file changed, 22 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/osmo-hnodeb/rua.c b/src/osmo-hnodeb/rua.c index e109ae0..d705c7c 100644 --- a/src/osmo-hnodeb/rua.c +++ b/src/osmo-hnodeb/rua.c @@ -115,6 +115,11 @@ 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);