[MM] - MF-196 Segmentation fault

I am testing the last ModemManager commit: f27dbda4a7b21aa4093d71c3886e67ca614e4f64 from the git repository 
and I have some issues.
The problem appears most of the times with the ZTE MF-196.

With ModemManager running I plug the modem, and then I force manual switching with:
usb_modeswitch -v 19d2 -p 1528 -c /etc/usb_modeswitch.d/19d2:0149
Unfortunately this modem does not switch to modem automatically in Fedora 18

After that, most of the times the following crash occurs:
ModemManager[32337]: <debug> [1363796739.044378] [mm-port-probe.c:137] mm_port_probe_set_result_at(): 
(tty/ttyACM0) port is AT-capable
ModemManager[32337]: <debug> [1363796739.044580] [mm-at-serial-port.c:397] debug_log(): (ttyACM2): <-- 
ModemManager[32337]: <debug> [1363796739.044994] [mm-at-serial-port.c:397] debug_log(): (ttyACM2): <-- '<CR>'
ModemManager[32337]: <debug> [1363796739.046015] [mm-at-serial-port.c:397] debug_log(): (ttyACM2): <-- 
'<CR><LF>+CMS ERROR: SM BL not ready<CR><LF>'
Segmentation fault (core dumped)

I execute with gdb and I obtain the following call stack trace when the Segmentation fault happend:

#0  mm_message_error_for_string (str=0x703c80 "SM BL not ready") at mm-error-helpers.c:248
#1  0x000000000046520f in mm_serial_parser_v1_parse (data=0x7fffec0046a0, response=0x714ae0, 
    at mm-serial-parsers.c:256
#2  0x0000000000484073 in parse_response (port=<optimized out>, response=0x7fffe8002580, 
error=0x7fffffffd408) at mm-at-serial-port.c:140
#3  0x000000000048323f in parse_response (error=0x7fffffffd408, response=<optimized out>, self=0x6e42f0) at 
#4  data_available (source=0x6e5f40, condition=<optimized out>, data=<optimized out>) at mm-serial-port.c:800
#5  0x0000003f83c47a75 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#6  0x0000003f83c47da8 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
#7  0x0000003f83c481a2 in g_main_loop_run () from /lib64/libglib-2.0.so.0
#8  0x0000000000424dd6 in main (argc=<optimized out>, argv=<optimized out>) at main.c:142

The problem lies in the following lines from mm-error-helpers.c
    /* Look for the string */
    for (i = 0; i < G_N_ELEMENTS (msg_errors); i++) {
        if (g_str_equal (msg_errors[i].error, buf)) {
            code = msg_errors[i].code;
            msg = msg_errors[i].message;

The msg_errors array has a length of 24 and for the last element the value of 'error' is NULL. So a call to 
g_str_equal (msg_errors[i].error, buf) will fail because it is expecting two valid pointers, but in this case 

So several patches can be applied to fix this issue.
The most simple is just to check the value of msg_errors[i].error:

--- a/src/mm-error-helpers.c
+++ b/src/mm-error-helpers.c
@@ -243,7 +243,7 @@ mm_message_error_for_string (const gchar *str)

     /* Look for the string */
     for (i = 0; i < G_N_ELEMENTS (msg_errors); i++) {
-        if (g_str_equal (msg_errors[i].error, buf)) {
+        if (msg_errors[i].error && g_str_equal (msg_errors[i].error, buf)) {
             code = msg_errors[i].code;
             msg = msg_errors[i].message;

Best regards,
José María González Calabozo

Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter 
confidencial exclusivamente dirigida a su destinatario o destinatarios. Si no es vd. el destinatario 
indicado, queda notificado que la lectura, utilización, divulgación y/o copia sin autorización está prohibida 
en virtud de la legislación vigente. En el caso de haber recibido este correo electrónico por error, se ruega 
notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.
Evite imprimir este mensaje si no es estrictamente necesario.

This email and any file attached to it (when applicable) contain(s) confidential information that is 
exclusively addressed to its recipient(s). If you are not the indicated recipient, you are informed that 
reading, using, disseminating and/or copying it without authorisation is forbidden in accordance with the 
legislation in effect. If you have received this email by mistake, please immediately notify the sender of 
the situation by resending it to their email address.
Avoid printing this message if it is not absolutely necessary.

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