summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem/gprs-context.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-06-11 09:17:27 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-06-11 09:20:05 -0500
commit76dc7e4acdea6a34bdd8dfae6cfe5be07f0550c6 (patch)
tree86fa948d758b3a91cf226c6734c8bbf39d7de5a7 /drivers/atmodem/gprs-context.c
parentc3dddcb5b3fd5218041525dc76b8683605919f63 (diff)
downloadofono-76dc7e4acdea6a34bdd8dfae6cfe5be07f0550c6.tar.bz2
atmodem: Shutdown ppp cleanly on remove
There is a race condition from udev / kernel when a USB dongle is removed. Sometimes all ports are removed first (and the io channels for those ports are signaled as hupped) while other times the udev remove event fires first. If the latter happens, then gprs_context remove is called with a potentially live ppp object. This patch shuts it down cleanly.
Diffstat (limited to 'drivers/atmodem/gprs-context.c')
-rw-r--r--drivers/atmodem/gprs-context.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index c7f681d4..4ddf88e7 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -254,6 +254,13 @@ static void at_gprs_context_remove(struct ofono_gprs_context *gc)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ DBG("");
+
+ if (gcd->state != STATE_IDLE) {
+ g_at_ppp_unref(gcd->ppp);
+ g_at_chat_resume(gcd->chat);
+ }
+
ofono_gprs_context_set_data(gc, NULL);
g_free(gcd);
}