diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-12-28 21:19:19 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-12-28 21:21:30 +0100 |
commit | 63ddf4645c1af041001060e91f982eb59b3deb5c (patch) | |
tree | 07040e4ca489a8995a2b8e29e9a11bb7ddc1db80 /src | |
parent | 7ae850337058168afc62cb4cac9cfc97b21d520b (diff) |
ipaccess: Fix crash when no IPA message is sent first on the RSL port
The issue was that the link has not been configured yet and the
list has not been initialized yet (it is NULL for next/prev).
Check if the ts is not configured before searching a link.
Reproduce with:
(Sockets.StreamSocket remote: 'localhost' port: 3003)
nextPutAll: #[0 1 0 0];
flush.
Backtrace:
#0 e1inp_lookup_sign_link (e1i=0x27af8c0, tei=0 '\000', sapi=0 '\000') at e1_input.c:437
437 if (link->sapi == sapi && link->tei == tei)
(gdb) bt
#0 e1inp_lookup_sign_link (e1i=0x27af8c0, tei=0 '\000', sapi=0 '\000') at e1_input.c:437
#1 0x00007f338ee87d49 in handle_ts1_read (bfd=0x27afe60) at input/ipaccess.c:436
#2 ipaccess_fd_cb (bfd=0x27afe60, what=1) at input/ipaccess.c:586
#3 0x00007f338f0976ce in osmo_select_main (polling=0) at select.c:158
#4 0x0000000000407394 in main (argc=<optimized out>, argv=0x7fff1aa4fed8) at bsc_hack.c:346
(gdb) p *e1i
$1 = {type = E1INP_TS_TYPE_NONE, num = 2, line = 0x222e860, lapd = 0x0, {sign = {
sign_links = {next = 0x0, prev = 0x0}, delay = 0, tx_timer = {node = {
rb_parent_color = 0, rb_right = 0x0, rb_left = 0x0}, list = {next = 0x0,
prev = 0x0}, timeout = {tv_sec = 0, tv_usec = 0}, active = 0, cb = 0, data = 0x0}},
trau = {demux = {chan_activ = 0 '\000', subch = {{
out_bitbuf = '\000' <repeats 319 times>, out_idx = 0, consecutive_zeros = 0,
in_sync = 0}, {out_bitbuf = '\000' <repeats 319 times>, out_idx = 0,
consecutive_zeros = 0, in_sync = 0}, {out_bitbuf = '\000' <repeats 319 times>,
out_idx = 0, consecutive_zeros = 0, in_sync = 0}, {
out_bitbuf = '\000' <repeats 319 times>, out_idx = 0, consecutive_zeros = 0,
in_sync = 0}}, out_cb = 0, data = 0x0}, mux = {subch = {{tx_queue = {next = 0x0,
prev = 0x0}}, {tx_queue = {next = 0x0, prev = 0x0}}, {tx_queue = {next = 0x0,
prev = 0x0}}, {tx_queue = {next = 0x0, prev = 0x0}}}}}}, driver = {misdn = {
fd = {list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, ipaccess = {
fd = {list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, dahdi = {fd = {
list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, rs232 = {fd = {
list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}}}
Diffstat (limited to 'src')
-rw-r--r-- | src/input/ipaccess.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 4a56569..9722b2f 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -429,6 +429,11 @@ static int handle_ts1_read(struct osmo_fd *bfd) ipaccess_rcvmsg(line, msg, bfd); msgb_free(msg); return 0; + } else if (e1i_ts->type == E1INP_TS_TYPE_NONE) { + /* this sign link is not know yet.. complain. */ + LOGP(DLINP, LOGL_ERROR, "Timeslot is not configured.\n"); + ret = -EINVAL; + goto err_msg; } /* BIG FAT WARNING: bfd might no longer exist here, since ipaccess_rcvmsg() * might have free'd it !!! */ |