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 <c.lobrano@gmail.com>
This commit is contained in:
Daniele Palmas
2021-10-08 11:42:04 +02:00
committed by Aleksander Morgado
parent 176b3f53c2
commit 41482d823b

View File

@@ -58,12 +58,14 @@ initialize_alternate_3g_band (MMSharedTelit *self,
MMKernelDevice *port; MMKernelDevice *port;
primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self))); 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 */ /* 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"); priv->alternate_3g_bands = mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_TELIT_BND_ALTERNATE");
if (priv->alternate_3g_bands) if (priv->alternate_3g_bands)
mm_obj_dbg (self, "telit modem using alternate 3G band mask setup"); mm_obj_dbg (self, "telit modem using alternate 3G band mask setup");
}
} }
static Private * static Private *