mirror of git://git.sysmocom.de/ofono
atmodem: fix crash during context deactivation
Ofono either crashed or busy looped with my Huawei E1552 3G modem when I tried to deactivate GPRS context. The reason was that gcd->chat was unreferenced already in setup_ppp() but the chat was still accessed later in at_gprs_deactivate_primary(). To fix the problem, change the logic instead to suspend chat session for PPP and resume when PPP has disconnected. Now it doesn't crash anymore. Deactivation still doesn't work properly with Huawei E1552, and most probably with other Huawei modems, because the modem hangs up the chat line after PPP deactivation. This needs to be fixed separately. The workaround is to reboot the modem, for example physically unplug and plug it in again.
This commit is contained in:
parent
bf7243eda4
commit
125c7c392f
|
@ -90,6 +90,8 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
|
|||
|
||||
DBG("");
|
||||
|
||||
g_at_chat_resume(gcd->chat);
|
||||
|
||||
switch (gcd->state) {
|
||||
case STATE_ENABLING:
|
||||
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, FALSE, NULL,
|
||||
|
@ -110,16 +112,19 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
|
|||
static gboolean setup_ppp(struct ofono_gprs_context *gc)
|
||||
{
|
||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||
GIOChannel *channel;
|
||||
GAtIO *io;
|
||||
|
||||
channel = g_at_chat_get_channel(gcd->chat);
|
||||
g_at_chat_unref(gcd->chat);
|
||||
io = g_at_chat_get_io(gcd->chat);
|
||||
|
||||
g_at_chat_suspend(gcd->chat);
|
||||
|
||||
/* open ppp */
|
||||
gcd->ppp = g_at_ppp_new(channel);
|
||||
gcd->ppp = g_at_ppp_new_from_io(io);
|
||||
|
||||
if (gcd->ppp == NULL)
|
||||
if (gcd->ppp == NULL) {
|
||||
g_at_chat_resume(gcd->chat);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password);
|
||||
|
||||
|
|
Loading…
Reference in New Issue