Change in osmo-hlr[master]: hlr.c: check the presence of msgb->l2h in read_cb()

Vadim Yanitskiy gerrit-no-reply at
Tue May 7 17:47:16 UTC 2019

Vadim Yanitskiy has submitted this change and it was merged. ( )

Change subject: hlr.c: check the presence of msgb->l2h in read_cb()

hlr.c: check the presence of msgb->l2h in read_cb()

Checking the presence of msgb->l2h in read_cb_forward() doesn't
make sense, since in read_cb() we pass it to osmo_gsup_decode().
Let's rather do this before calling osmo_gsup_decode().

Fix for Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Change-Id: I69a3d31aacbbb1abef3d83e42e46c899fe2f914b
M src/hlr.c
1 file changed, 6 insertions(+), 6 deletions(-)

  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  Neels Hofmeyr: Looks good to me, approved

diff --git a/src/hlr.c b/src/hlr.c
index 3df700a..84daa47 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -483,11 +483,6 @@
 		goto end;
-	if (!msgb_l2(msg) || !msgb_l2len(msg)) {
-		LOGP_GSUP_FWD(gsup, LOGL_ERROR, "missing or empty l2 data\n");
-		goto end;
-	}
 	/* Forward message without re-encoding (so we don't remove unknown IEs) */
 	LOGP_GSUP_FWD(gsup, LOGL_INFO, "checks passed, forwarding\n");
@@ -524,10 +519,15 @@
 	static struct osmo_gsup_message gsup;
 	int rc;
+	if (!msgb_l2(msg) || !msgb_l2len(msg)) {
+		LOGP(DMAIN, LOGL_ERROR, "missing or empty L2 data\n");
+		return -EINVAL; /* FIXME: msgb_free(msg); */
+	}
 	rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
 	if (rc < 0) {
 		LOGP(DMAIN, LOGL_ERROR, "error in GSUP decode: %d\n", rc);
-		return rc;
+		return rc; /* FIXME: msgb_free(msg); */
 	/* 3GPP TS 23.003 Section 2.2 clearly states that an IMSI with less than 5

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I69a3d31aacbbb1abef3d83e42e46c899fe2f914b
Gerrit-Change-Number: 13899
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at>
Gerrit-Reviewer: Harald Welte <laforge at>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list