Change in osmo-msc[master]: smpp: fix vlr_subscr use count bugs

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Apr 15 11:49:56 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13638


Change subject: smpp: fix vlr_subscr use count bugs
......................................................................

smpp: fix vlr_subscr use count bugs

In smpp_openbsc.c submit_to_sms(), "get" the appropriate use count upon
assigning sms->receiver, fixing a -1 use count upon sms_free().

Also, avoid a "put" of a NULL subscriber in the same function.

Related: OS#3930
Change-Id: Idaf01cd3cfa08088ce0d543d0576db957dc94262
---
M src/libmsc/smpp_openbsc.c
1 file changed, 8 insertions(+), 1 deletion(-)



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

diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 01c39f9..151c788 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -139,7 +139,8 @@
 		} else {
 			LOGP(DLSMS, LOGL_ERROR,
 			     "SMPP neither message payload nor valid sm_length.\n");
-			vlr_subscr_put(dest, VSUB_USE_SMPP);
+			if (dest)
+				vlr_subscr_put(dest, VSUB_USE_SMPP);
 			return ESME_RINVPARLEN;
 		}
 	}
@@ -152,6 +153,12 @@
 
 	/* fill in the destination address */
 	sms->receiver = dest;
+	if (dest) {
+		/* Replace use count from above subscr_by_dst (VSUB_USE_SMPP) by the sms->receiver use count
+		 * (VSUB_USE_SMS_RECEIVER) */
+		vlr_subscr_get(sms->receiver, VSUB_USE_SMS_RECEIVER);
+		vlr_subscr_put(dest, VSUB_USE_SMPP);
+	}
 	sms->dst.ton = submit->dest_addr_ton;
 	sms->dst.npi = submit->dest_addr_npi;
 	if (dest)

-- 
To view, visit https://gerrit.osmocom.org/13638
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: Idaf01cd3cfa08088ce0d543d0576db957dc94262
Gerrit-Change-Number: 13638
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190415/56653185/attachment.html>


More information about the gerrit-log mailing list