path: root/openbsc/src/chan_alloc.c
diff options
authorHarald Welte (local) <laflocal@hanuman.gnumonks.org>2009-12-27 18:12:29 +0100
committerHarald Welte (local) <laflocal@hanuman.gnumonks.org>2009-12-27 18:12:29 +0100
commit1fa3b78f4ae81bba8a750317aa684ddcbddc22cb (patch)
tree62dda9c4cba5496f3290148ed3de12bae293db6f /openbsc/src/chan_alloc.c
parent945b8da98c669fb52dd9d105181fce434e064401 (diff)
Introduce new ACT_REQ state to prevent race condition during channel allocation
When we allocate a channel, we send the RSL CHAN ACT REQ and wait until we get a CHAN ACT ACK. Only the ACK will change the state, so there is a race where we allocate that same channel to a different channel request before we get the ACT ACK. Introducing a new ACT_REQ state resolves this issue.
Diffstat (limited to 'openbsc/src/chan_alloc.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 4bdf722b0..abf4de891 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -175,7 +175,8 @@ _lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan)
/* check if all sub-slots are allocated yet */
for (ss = 0; ss < subslots_per_pchan[pchan]; ss++) {
struct gsm_lchan *lc = &ts->lchan[ss];
- if (lc->type == GSM_LCHAN_NONE)
+ if (lc->type == GSM_LCHAN_NONE &&
+ lc->state == LCHAN_S_NONE)
return lc;