Change in osmo-bsc[master]: mscpool: fix refcount leak for unusual case of no bts

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Fri Aug 21 12:56:35 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/19761 )


Change subject: mscpool: fix refcount leak for unusual case of no bts
......................................................................

mscpool: fix refcount leak for unusual case of no bts

by reading the code, I notice that a refcount on the subscr would be leaked if
there were no bts. That is not realistically happening, but nevertheless rather
rejigger so that no leak is possible, ever.

Change-Id: I0b804b8136cd78a777ca02667f696cdefa90c4a9
---
M src/osmo-bsc/gsm_08_08.c
1 file changed, 4 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/61/19761/1

diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index d5915f4..e7ef728 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -198,6 +198,7 @@
 	bool is_emerg = false;
 	int16_t nri_v = -1;
 	bool is_null_nri = false;
+	struct gsm_bts *bts;
 
 	if (msgb_l3len(msg) < sizeof(*gh)) {
 		LOGP(DRSL, LOGL_ERROR, "There is no GSM48 header here.\n");
@@ -221,10 +222,10 @@
 	}
 
 	/* Has the subscriber been paged from a connected MSC? */
-	if (pdisc == GSM48_PDISC_RR && mtype == GSM48_MT_RR_PAG_RESP) {
+	bts = conn_get_bts(conn);
+	if (bts && pdisc == GSM48_PDISC_RR && mtype == GSM48_MT_RR_PAG_RESP) {
 		subscr = bsc_subscr_find_by_mi(conn->network->bsc_subscribers, &mi);
-		struct gsm_bts *bts = conn_get_bts(conn);
-		if (bts && subscr) {
+		if (subscr) {
 			msc_target = paging_get_msc(bts, subscr);
 			bsc_subscr_put(subscr);
 			if (is_msc_usable(msc_target, is_emerg)) {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0b804b8136cd78a777ca02667f696cdefa90c4a9
Gerrit-Change-Number: 19761
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200821/78a15f51/attachment.htm>


More information about the gerrit-log mailing list