From 41482d823b8d03520a284a6fe2263aeaf9f30c46 Mon Sep 17 00:00:00 2001 From: Daniele Palmas Date: Fri, 8 Oct 2021 11:42:04 +0200 Subject: [PATCH] telit: fix segmentation fault in initialize_alternate_3g_band Fix the following segmentation fault: ModemManager[128007]: mm_port_peek_kernel_device: assertion 'MM_IS_PORT (self)' failed Thread 1 "ModemManager" received signal SIGSEGV, Segmentation fault. 0x00005555556c6e3e in mm_kernel_device_get_global_property (self=0x0, property=0x7ffff5947480 "ID_MM_TELIT_BND_ALTERNATE") at kerneldevice/mm-kernel-device.c:309 Reported by Carlo Lobrano --- plugins/telit/mm-shared-telit.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/telit/mm-shared-telit.c b/plugins/telit/mm-shared-telit.c index 9a5aa838..f32bf9af 100644 --- a/plugins/telit/mm-shared-telit.c +++ b/plugins/telit/mm-shared-telit.c @@ -58,12 +58,14 @@ initialize_alternate_3g_band (MMSharedTelit *self, MMKernelDevice *port; primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self))); - port = mm_port_peek_kernel_device (primary); + if (primary) { + port = mm_port_peek_kernel_device (primary); - /* Lookup for the tag specifying that we're using the alternate 3G band mapping */ - priv->alternate_3g_bands = mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_TELIT_BND_ALTERNATE"); - if (priv->alternate_3g_bands) - mm_obj_dbg (self, "telit modem using alternate 3G band mask setup"); + /* Lookup for the tag specifying that we're using the alternate 3G band mapping */ + priv->alternate_3g_bands = mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_TELIT_BND_ALTERNATE"); + if (priv->alternate_3g_bands) + mm_obj_dbg (self, "telit modem using alternate 3G band mask setup"); + } } static Private *