[MM] [PATCH] broadband-modem: disconnect bearers only if the bearer list still exists



This patch fixes a crash when MMBroadbandModem tries to access an
already cleared bearer list during the disabling steps.

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7f6eed4c40a3   [ModemManager]             - mm-bearer-list.c:259       mm_bearer_list_disconnect_all_bearers
0x7f6eed4cd6f8   [ModemManager]             - mm-iface-modem.c:1216      handle_enable_auth_ready
0x7f6eed332676   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:749   g_simple_async_result_complete
0x7f6eed4c5750   [ModemManager]             - mm-base-modem.c:1015       authorize_ready
0x7f6eed332676   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:749   g_simple_async_result_complete
0x7f6eed332788   [libgio-2.0.so.0.3000.2]   - gsimpleasyncresult.c:761   complete_in_idle_cb
0x7f6eecf36f44   [libglib-2.0.so.0.3000.2]  - gmain.c:2441               g_main_context_dispatch
0x7f6eecf37597   [libglib-2.0.so.0.3000.2]  - gmain.c:3089               g_main_context_iterate
0x7f6eecf37b51   [libglib-2.0.so.0.3000.2]  - gmain.c:3297               g_main_loop_run
0x7f6eed4b5ad1   [ModemManager]             - main.c:150                 main
0x7f6eec95141c   [libc-2.15.so]             - libc-start.c:234           __libc_start_main
0x7f6eed4b55e8   [ModemManager]             + 0x0001a5e8
---
 src/mm-broadband-modem.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 4a2fdb8..64df821 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -6883,11 +6883,15 @@ disabling_step (DisablingContext *ctx)
         ctx->step++;
 
     case DISABLING_STEP_DISCONNECT_BEARERS:
-        mm_bearer_list_disconnect_all_bearers (
-            ctx->self->priv->modem_bearer_list,
-            (GAsyncReadyCallback)bearer_list_disconnect_all_bearers_ready,
-            ctx);
-        return;
+        if (ctx->self->priv->modem_bearer_list) {
+            mm_bearer_list_disconnect_all_bearers (
+                ctx->self->priv->modem_bearer_list,
+                (GAsyncReadyCallback)bearer_list_disconnect_all_bearers_ready,
+                ctx);
+            return;
+        }
+        /* Fall down to next step */
+        ctx->step++;
 
     case DISABLING_STEP_IFACE_SIMPLE:
         /* Fall down to next step */
-- 
1.7.12



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