Change in osmo-bsc[master]: hodec2: fix segv for inter-BSC ho target

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
Wed Nov 24 14:24:36 UTC 2021


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


Change subject: hodec2: fix segv for inter-BSC ho target
......................................................................

hodec2: fix segv for inter-BSC ho target

Related: OS#5324 SYS#5259
Change-Id: I5a3345ab0005a73597f5c27207480912a2f5aae6
---
M src/osmo-bsc/handover_decision_2.c
1 file changed, 30 insertions(+), 18 deletions(-)



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

diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index 6730f26..14bc2d4 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -1027,27 +1027,39 @@
 		break;
 	}
 
-	chan_counts_for_bts(&bts_counts, c->target.bts);
-	c->target.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F];
-	c->target.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->target.bts->ho);
-	c->target.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H];
-	c->target.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->target.bts->ho);
+	/* For inter-BSC handover, the target BTS is in a different BSC and hence NULL here. */
+	if (c->target.bts) {
+		chan_counts_for_bts(&bts_counts, c->target.bts);
+		c->target.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F];
+		c->target.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->target.bts->ho);
+		c->target.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H];
+		c->target.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->target.bts->ho);
 
-	/* Would the next TCH/F lchan occupy a dynamic timeslot that currently counts for free TCH/H timeslots? */
-	next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_F, false);
-	if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN)
-		c->target.next_tchf_reduces_tchh = 2;
-	else
-		c->target.next_tchf_reduces_tchh = 0;
+		/* Would the next TCH/F lchan occupy a dynamic timeslot that currently counts for free TCH/H timeslots?
+		 */
+		next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_F, false);
+		if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN)
+			c->target.next_tchf_reduces_tchh = 2;
+		else
+			c->target.next_tchf_reduces_tchh = 0;
 
-	/* Would the next TCH/H lchan occupy a dynamic timeslot that currently counts for free TCH/F timeslots?
-	 * Note that a dyn TS already in TCH/H mode (half occupied) would not reduce free TCH/F. */
-	next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_H, false);
-	if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN
-	    && next_lchan->ts->pchan_is != GSM_PCHAN_TCH_H)
-		c->target.next_tchh_reduces_tchf = 1;
-	else
+		/* Would the next TCH/H lchan occupy a dynamic timeslot that currently counts for free TCH/F timeslots?
+		 * Note that a dyn TS already in TCH/H mode (half occupied) would not reduce free TCH/F. */
+		next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_H, false);
+		if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN
+		    && next_lchan->ts->pchan_is != GSM_PCHAN_TCH_H)
+			c->target.next_tchh_reduces_tchf = 1;
+		else
+			c->target.next_tchh_reduces_tchf = 0;
+	} else {
+
+		c->target.free_tchf = 0;
+		c->target.min_free_tchf = 0;
 		c->target.next_tchh_reduces_tchf = 0;
+		c->target.free_tchh = 0;
+		c->target.min_free_tchh = 0;
+		c->target.next_tchf_reduces_tchh = 0;
+	}
 }
 
 /* add candidate for re-assignment within the current cell */

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I5a3345ab0005a73597f5c27207480912a2f5aae6
Gerrit-Change-Number: 26352
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/20211124/db3ef27b/attachment.htm>


More information about the gerrit-log mailing list