Change in ...osmo-msc[master]: gsm_04_11_gsup.c: fix broken reference counting for vsub

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jun 19 13:11:58 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/14540


Change subject: gsm_04_11_gsup.c: fix broken reference counting for vsub
......................................................................

gsm_04_11_gsup.c: fix broken reference counting for vsub

This change is similar to I5540556b1c75f6873883e46b78656f31fc1ef186.
In gsm411_gsup_rx() we do call vlr_subscr_find_by_imsi(), which
increases subscriber's reference count by one using the function
name as the token. However, we never release this token, so the
reference count grows on every received GSUP FORWARD-SM message.

Change-Id: Ic729beb5f94cbbfbb251bc9ab66a5e7b799286c0
---
M src/libmsc/gsm_04_11_gsup.c
1 file changed, 11 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/40/14540/1

diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 331092a..2abfc92 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -287,8 +287,10 @@
 int gsm411_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg)
 {
 	struct gsm_network *net = (struct gsm_network *) data;
-	struct vlr_subscr *vsub = vlr_subscr_find_by_imsi(net->vlr, gsup_msg->imsi, __func__);
+	struct vlr_subscr *vsub;
+	int rc;
 
+	vsub = vlr_subscr_find_by_imsi(net->vlr, gsup_msg->imsi, __func__);
 	if (!vsub) {
 		LOGP(DLSMS, LOGL_ERROR, "Rx %s for unknown subscriber, rejecting\n",
 		     osmo_gsup_message_type_name(gsup_msg->message_type));
@@ -303,16 +305,21 @@
 	case OSMO_GSUP_MSGT_READY_FOR_SM_ERROR:
 	case OSMO_GSUP_MSGT_READY_FOR_SM_RESULT:
 		DEBUGP(DMSC, "Routed to GSM 04.11 MO handler\n");
-		return gsm411_gsup_mo_handler(net, vsub, gsup_msg);
+		rc = gsm411_gsup_mo_handler(net, vsub, gsup_msg);
+		break;
 
 	/* GSM 04.11 code implementing MT SMS */
 	case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST:
 		DEBUGP(DMSC, "Routed to GSM 04.11 MT handler\n");
-		return gsm411_gsup_mt_handler(net, vsub, gsup_msg);
+		rc = gsm411_gsup_mt_handler(net, vsub, gsup_msg);
+		break;
 
 	default:
 		LOGP(DMM, LOGL_ERROR, "No handler found for %s, dropping message...\n",
 			osmo_gsup_message_type_name(gsup_msg->message_type));
-		return -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
+		rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
 	}
+
+	vlr_subscr_put(vsub, __func__);
+	return rc;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14540
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic729beb5f94cbbfbb251bc9ab66a5e7b799286c0
Gerrit-Change-Number: 14540
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190619/aaf2ff51/attachment.html>


More information about the gerrit-log mailing list