[MM] [PATCH] device: handle NULL returned by g_udev_device_get_driver() gracefully



This patch fixes a crash in mm_device_grab_port() when doing a string
comparison on a NULL returned by g_udev_device_get_driver().

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x76b760b4   [libc-2.15.so]               - strcmp.c:38                      strcmp
0x76c66a7d   [libglib-2.0.so.0.3200.4]    - ghash.c:1704                     g_str_equal
0x76ee0e5d   [ModemManager]               - mm-device.c:147                  mm_device_grab_port
0x76edf9d9   [ModemManager]               - mm-manager.c:313                 device_added
0x76e95b2d   [libgudev-1.0.so.0.1.0]      - extras/gudev/gudevmarshal.c:84   
g_udev_marshal_VOID__STRING_OBJECT
0x76d1fb2b   [libgobject-2.0.so.0.3200.4] - gclosure.c:777                   g_closure_invoke
0x76d2b88b   [libgobject-2.0.so.0.3200.4] - gsignal.c:3551                   signal_emit_unlocked_R
0x76d313c5   [libgobject-2.0.so.0.3200.4] - gsignal.c:3300                   g_signal_emit_valist
0x76d31569   [libgobject-2.0.so.0.3200.4] - gsignal.c:3356                   g_signal_emit
0x76e93bdd   [libgudev-1.0.so.0.1.0]      - extras/gudev/gudevclient.c:105   monitor_event
0x76c9beb7   [libglib-2.0.so.0.3200.4]    - giounix.c:166                    g_io_unix_dispatch
0x76c714c1   [libglib-2.0.so.0.3200.4]    - gmain.c:2539                     g_main_context_dispatch
0x76c71745   [libglib-2.0.so.0.3200.4]    - gmain.c:3146                     g_main_context_iterate
0x76c71a59   [libglib-2.0.so.0.3200.4]    - gmain.c:3340                     g_main_loop_run
0x76ede8ed   [ModemManager]               - main.c:142                       main
0x76b35f79   [libc-2.15.so]               - libc-start.c:226                 __libc_start_main
0x76edea49   [ModemManager]               + 0x00014a49
0x76eb4eab   [ld-2.15.so]                 + 0x0000aeab
---
 src/mm-device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mm-device.c b/src/mm-device.c
index 7800439..a2755a7 100644
--- a/src/mm-device.c
+++ b/src/mm-device.c
@@ -145,7 +145,7 @@ get_device_ids (GUdevDevice *device,
                 success = TRUE;
                 goto out;
             } else if (g_str_has_prefix (parent_subsys, "usb") &&
-                       g_str_equal (g_udev_device_get_driver (parent), "qmi_wwan")) {
+                       !g_strcmp0 (g_udev_device_get_driver (parent), "qmi_wwan")) {
                 /* Need to look for vendor/product in the parent of the QMI device */
                 GUdevDevice *qmi_parent;
 
-- 
1.8.1.3



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