Change in osmo-msc[master]: smpp: Fix SMS-receiver put assertion

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Apr 15 10:29:49 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13637


Change subject: smpp: Fix SMS-receiver put assertion
......................................................................

smpp: Fix SMS-receiver put assertion

Catched by osmo-gsm-tester smpp/esme_ms_sms_transaction.py

In sms_free(), if sms->receiver is set, then VSUB_USE_SMS_RECEIVER is
put. However, If sms comes from SMPP (ESME), dest was being referenced
in smpp_openbsc.c:submit_to_sms by means of VSUB_USE_SMPP.

As a result, during sms_free(), following assertion was triggered:
DREF  gsm_04_11.c:74 VLR subscr IMSI-901700000015252:MSISDN-7846:TMSI-0x2A74BA76 - SMS-receiver: now used by 3 (attached,SMPP,SMS,conn,-1*SMS-receiver)
Assert failed _osmo_use_count_get_put(&(sms->receiver)->use_count, "SMS-receiver", -1, "gsm_04_11.c", 74) == 0 gsm_04_11.c:74

Solve it by dropping reference to VSUB_USE_SMPP and referencing
VSUB_USE_SMS_RECEIVER once we are done using dest in SMPP code and store
it in sms->receiver.

Fixes: 7c5346cd7005ad469702a2f74572b79de738fbbb ("vlr_subscr: use osmo_use_count")
Change-Id: Ida8628c3c0569a2e3bd66c591d57eb93bf1fab14
---
M src/libmsc/smpp_openbsc.c
1 file changed, 5 insertions(+), 1 deletion(-)



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

diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 01c39f9..25d649b 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -151,7 +151,6 @@
 	sms->msg_ref = msg_ref;
 
 	/* fill in the destination address */
-	sms->receiver = dest;
 	sms->dst.ton = submit->dest_addr_ton;
 	sms->dst.npi = submit->dest_addr_npi;
 	if (dest)
@@ -159,6 +158,11 @@
 	else
 		OSMO_STRLCPY_ARRAY(sms->dst.addr,
 				   (const char *)submit->destination_addr);
+	if (dest) {
+		sms->receiver = dest;
+		vlr_subscr_get(sms->receiver, VSUB_USE_SMS_RECEIVER);
+		vlr_subscr_put(dest, VSUB_USE_SMPP);
+	}
 
 	/* fill in the source address */
 	sms->src.ton = submit->source_addr_ton;

-- 
To view, visit https://gerrit.osmocom.org/13637
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida8628c3c0569a2e3bd66c591d57eb93bf1fab14
Gerrit-Change-Number: 13637
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190415/c96a8c7a/attachment.html>


More information about the gerrit-log mailing list