[PATCH] broadband-modem, modem-helpers: improve +CGDCONT? error handling
Ben Chan
benchan at chromium.org
Thu Mar 13 15:45:08 PDT 2014
This patch fixes the following crash, which happens when
MMBroadbandBearer tries to parse the NULL response of a failed +CGDCONT?
query. It also fixes a leak in parse_pdp_list where it fails to free the
GError object return by mm_3gpp_parse_cgdcont_read_response.
Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )
0x7feb15564c11 [ModemManager] - mm-modem-helpers.c:850 mm_3gpp_parse_cgdcont_read_response
0x7feb15518e51 [ModemManager] - mm-broadband-bearer.c:927 parse_pdp_list
0x7feb1551ada2 [ModemManager] - mm-base-modem-at.c:189 at_sequence_parse_response
0x7feb151d4b86 [libgio-2.0.so.0.3400.3] - gsimpleasyncresult.c:775 g_simple_async_result_complete
0x7feb1556e223 [ModemManager] - mm-port-serial-at.c:355 serial_command_ready
0x7feb151d4b86 [libgio-2.0.so.0.3400.3] - gsimpleasyncresult.c:775 g_simple_async_result_complete
0x7feb1556a834 [ModemManager] - mm-port-serial.c:141 command_context_complete_and_free
0x7feb1556bc26 [ModemManager] - mm-port-serial.c:734 port_serial_got_response
0x7feb1556c51a [ModemManager] - mm-port-serial.c:758 port_serial_timed_out
0x7feb1508cc33 [libglib-2.0.so.0.3400.3] - gmain.c:4026 g_timeout_dispatch
0x7feb1508c087 [libglib-2.0.so.0.3400.3] - gmain.c:2715 g_main_context_dispatch
0x7feb1508c437 [libglib-2.0.so.0.3400.3] - gmain.c:3290 g_main_context_iterate
0x7feb1508c891 [libglib-2.0.so.0.3400.3] - gmain.c:3484 g_main_loop_run
0x7feb1550ad16 [ModemManager] - main.c:154 main
0x7feb14a9e9c6 [libc-2.15.so] - libc-start.c:234 __libc_start_main
0x7feb1550a808 [ModemManager + 0x00023808
---
src/mm-broadband-bearer.c | 14 ++++++++++++--
src/mm-modem-helpers.c | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index bb2209e..a697e08 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -924,10 +924,20 @@ parse_pdp_list (MMBaseModem *modem,
return FALSE;
}
+ if (error) {
+ mm_dbg ("Unexpected +CGDCONT? error: '%s'", error->message);
+ return FALSE;
+ }
+
pdp_list = mm_3gpp_parse_cgdcont_read_response (response, &inner_error);
if (!pdp_list) {
- /* No predefined PDP contexts found */
- mm_dbg ("No PDP contexts found");
+ if (inner_error) {
+ mm_dbg ("%s", inner_error->message);
+ g_error_free (inner_error);
+ } else {
+ /* No predefined PDP contexts found */
+ mm_dbg ("No PDP contexts found");
+ }
return FALSE;
}
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 9eefb33..8bdc0e7 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -847,7 +847,7 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
GMatchInfo *match_info;
GList *list;
- if (!reply[0])
+ if (!reply || !reply[0])
/* No APNs configured, all done */
return NULL;
--
1.9.0.279.gdc9e3eb
More information about the ModemManager-devel
mailing list