[MM] [PATCH] iface-modem-3gpp, iface-modem-cdma: check for deallocated RegistrationCheckContext



This patch fixes a crash in periodic_registration_checks_ready() due to
access of an already deallocated RegistrationCheckContext.

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7fc344d355cd   [ModemManager]             - mm-iface-modem-cdma.c:1112   periodic_registration_checks_ready
0x7fc3449ea266   [libgio-2.0.so.0.3200.4]   - gsimpleasyncresult.c:767     g_simple_async_result_complete
0x7fc3449ea368   [libgio-2.0.so.0.3200.4]   - gsimpleasyncresult.c:779     complete_in_idle_cb
0x7fc344851dc4   [libglib-2.0.so.0.3200.4]  - gmain.c:2539                 g_main_context_dispatch
0x7fc344852147   [libglib-2.0.so.0.3200.4]  - gmain.c:3146                 g_main_context_iterate
0x7fc3448525a1   [libglib-2.0.so.0.3200.4]  - gmain.c:3340                 g_main_loop_run
0x7fc344d0f154   [ModemManager]             - main.c:158                   main
0x7fc34426a474   [libc-2.15.so]             - libc-start.c:234             __libc_start_main
0x7fc344d0eb68   [ModemManager]             + 0x0001bb68
---
 src/mm-iface-modem-3gpp.c |    3 ++-
 src/mm-iface-modem-cdma.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 1e0cd30..7a88b2f 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1147,7 +1147,8 @@ periodic_registration_checks_ready (MMIfaceModem3gpp *self,
 
     /* Remove the running tag */
     ctx = g_object_get_qdata (G_OBJECT (self), registration_check_context_quark);
-    ctx->running = FALSE;
+    if (ctx)
+        ctx->running = FALSE;
 }
 
 static gboolean
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
index 8478df5..d582fb3 100644
--- a/src/mm-iface-modem-cdma.c
+++ b/src/mm-iface-modem-cdma.c
@@ -1109,7 +1109,8 @@ periodic_registration_checks_ready (MMIfaceModemCdma *self,
 
     /* Remove the running tag */
     ctx = g_object_get_qdata (G_OBJECT (self), registration_check_context_quark);
-    ctx->running = FALSE;
+    if (ctx)
+        ctx->running = FALSE;
 }
 
 static gboolean
-- 
1.7.7.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]