Re: mISDNcapid still segfaults sometimes
Karsten Keil <[email protected]>
| Newsgroups | gmane.linux.isdn.i4l.user |
|---|---|
| Message-ID | <[email protected]> |
Am 24.05.2012 13:22, schrieb Tobias Powalowski: > plci_cc_disconnect_ind():PLCI 0101: Got Disconnect with cause 16 (0x10) > loc 01 > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0xb7b85b40 (LWP 6543)] > 0x080580ca in get_lPLCI4Id (plci=0xb7201e90, appId=2) at mplci.c:245 > 245 mplci.c: Datei oder Verzeichnis nicht gefunden. > (gdb) backtrace > #0 0x080580ca in get_lPLCI4Id (plci=0xb7201e90, appId=2) at mplci.c:245 > #1 0x08057930 in plciAttach_lPLCI (plci=0xb7201e90, lp=0xb7201e90) > at mplci.c:77 > #2 0x08057bc4 in plciHandleSetupInd (plci=0xb7201e90, pr=5, mc=0xb6849b70) > at mplci.c:138 > #3 0x08057e6a in plci_l3l4 (plci=0xb7201e90, pr=5, l3m=0xb72004a8) > at mplci.c:185 > #4 0x0804d34a in l3_callback (l3=0x8093c68, cmd=5, pid=65629, > l3m=0xb72004a8) > at daemon.c:951 > #5 0xb7f98fe0 in mISDN_l3up (l3p=0xb7201df8, prim=5, l3m=0xb72004a8) > at layer3/layer3.c:393 > #6 0xb7f94718 in l3dss1_setup (pc=0xb7201df8, pr=12552, l3m=0xb72004a8) > at layer3/dss1user.c:879 > #7 0xb7f97669 in dss1_fromdown (l3=0x8093c68, msg=0xb7200468) > at layer3/dss1user.c:2247 > #8 0xb7f9a1c3 in handle_l2msg (l3=0x8093c68, mb=0xb7200468) > at layer3/layer3.c:784 > #9 0xb7f9acd4 in layer3_thread (arg=0x8093c68) at layer3/layer3.c:922 > #10 0xb7e36ce8 in start_thread () from /lib/libpthread.so.0 > #11 0xb7d754de in clone () from /lib/libc.so.6 > OK this would be at if (appId == lp->lc->Appl->AppId) so I assume lp->lc is NULL or lp->lc->Appl is NULL. This patch should prevent this crash, but maybe it is not the final solution. (Is also on git.misdn.eu). Karsten _______________________________________________ isdn4linux mailing list [email protected] https://www.isdn4linux.de/mailman/listinfo/isdn4linux
0001-Avoid-crash-in-get_lPLCI4Id.patch
(text/x-patch, 1.2 KB)
From 78179356a6c6f78118e366b6cb49e433604a2f7f Mon Sep 17 00:00:00 2001 From: Karsten Keil <[email protected]> Date: Thu, 24 May 2012 15:25:48 +0200 Subject: [PATCH] Avoid crash in get_lPLCI4Id() Maybe in a race on setup/cleanup the links are broken. Signed-off-by: Karsten Keil <[email protected]> --- capi20/mplci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/capi20/mplci.c b/capi20/mplci.c index 9ea5885..e46ece3 100644 --- a/capi20/mplci.c +++ b/capi20/mplci.c @@ -237,13 +237,23 @@ int mPLCISendMessage(struct lController *lc, struct mc_buf *mc) struct lPLCI *get_lPLCI4Id(struct mPLCI *plci, uint16_t appId) { struct lPLCI *lp; + struct lController *lc; + struct mApplication *app; if (!plci) return NULL; lp = plci->lPLCIs; while (lp) { - if (appId == lp->lc->Appl->AppId) - break; + lc = lp->lc; + if (lc) { + app = lc->Appl; + if (app) { + if (appId == app->AppId) + break; + } else + wprint("PLCI:%04x lc no application assigned\n", plci->plci); + } else + wprint("PLCI:%04x lp no lc assigned\n", plci->plci); lp = lp->next; } return lp; -- 1.7.3.4