aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-13 14:15:39 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-13 14:15:39 +0800
commitfea0aebd368d1b0a661170ec985f6a91d5ad4723 (patch)
tree33cc22bf0bcaa941d9ef3a10e50085bfc0cb8ed0
parentc9b7d74a087fa136629ab1419df5af199dce5ec2 (diff)
bsc_msc_ip: Attempt to plug an lchan leak...
If we end up with a channel that has refcount of zero, has no msc_data attached and the handler has not returned 1 we will just close it.
-rw-r--r--openbsc/src/bsc_msc_ip.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index c133ef58c..558c0345e 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -289,8 +289,6 @@ static int open_sccp_connection(struct msgb *layer3)
/* When not connected to a MSC. We will simply close things down. */
if (!bsc_gsmnet->msc_con->is_authenticated) {
LOGP(DMSC, LOGL_ERROR, "Not connected to a MSC. Not forwarding data.\n");
- use_subscr_con(&layer3->lchan->conn);
- put_subscr_con(&layer3->lchan->conn, 0);
return -1;
}
@@ -611,6 +609,12 @@ int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id)
}
bsc_queue_connection_write(lchan_get_sccp(msg->lchan), dtap);
+ } else if (rc <= 0 && !msg->lchan->msc_data && msg->lchan->conn.use_count == 0) {
+ if (msg->lchan->state == LCHAN_S_ACTIVE) {
+ LOGP(DMSC, LOGL_NOTICE, "Closing unowned channel.\n");
+ use_subscr_con(&msg->lchan->conn);
+ put_subscr_con(&msg->lchan->conn, 0);
+ }
}
return rc;