[PATCH 5/7] [gsm_04_08] Fix subscr ref leak for multi CM SERV REQ

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/OpenBSC@lists.osmocom.org/.

Sylvain Munaut 246tnt at gmail.com
Fri Dec 18 17:28:10 UTC 2009


From: Sylvain Munaut <tnt at 246tNt.com>

Multiple CM SERVICE REQUEST can happen on a single RR
connection, in this case, since the subscr reference is
tracked through lchan->subscr and will only be put'd once
on lchan_free, we need to make sure we don't get several
reference ....

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
---
 openbsc/src/gsm_04_08.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 5fea6bf..f87b335 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1343,7 +1343,9 @@ static int gsm48_rx_mm_serv_req(struct msgb *msg)
 
 	if (!msg->lchan->subscr)
 		msg->lchan->subscr = subscr;
-	else if (msg->lchan->subscr != subscr) {
+	else if (msg->lchan->subscr == subscr)
+		subscr_put(subscr); /* lchan already has a ref, don't need another one */
+	else {
 		DEBUGP(DMM, "<- CM Channel already owned by someone else?\n");
 		subscr_put(subscr);
 	}
-- 
1.6.5.1





More information about the OpenBSC mailing list