Re: [PATCH] mm-base-manager: ref MMDevice before releasing port

2018-02-22 Thread Dan Williams
On Wed, 2018-02-21 at 13:49 -0800, Eric Caruso wrote:
> Releasing the port on the device looks benign but because it emits
> a signal, it could call device_context_port_released and unref the
> MMDevice in port_context_unref. This means the MMDevice might be
> disposed before we get to the g_object_ref and the subsequent call
> to g_hash_table_remove will try to hash a null string, which makes
> MM crash.

The refcounting looks a bit convoluted in the existing code, but the
patch LGTM for now.

Dan

> ---
>  src/mm-base-manager.c | 30 +++---
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
> index 4b92ab0b..7738ce0d 100644
> --- a/src/mm-base-manager.c
> +++ b/src/mm-base-manager.c
> @@ -220,28 +220,28 @@ device_removed (MMBaseManager  *self,
>  /* Handle tty/net/wdm port removal */
>  device = find_device_by_port (self, kernel_device);
>  if (device) {
> +/* The callbacks triggered when the port is released or
> device support is
> + * cancelled may end up unreffing the device or removing
> it from the HT, and
> + * so in order to make sure the reference is still valid
> when we call
> + * support_check_cancel() and g_hash_table_remove(), we
> hold a full reference
> + * ourselves. */
> +g_object_ref (device);
> +
>  mm_info ("(%s/%s): released by device '%s'", subsys,
> name, mm_device_get_uid (device));
>  mm_device_release_port (device, kernel_device);
>  
>  /* If port probe list gets empty, remove the device
> object iself */
>  if (!mm_device_peek_port_probe_list (device)) {
> -/* The callback triggered when the device support is
> cancelled may end up
> - * removing the device from the HT, and that was the
> last full reference
> - * we kept. So, in order to make sure the reference
> is still valid after
> - * support_check_cancel(), we hold a full reference
> ourselves. */
>  mm_dbg ("Removing empty device '%s'",
> mm_device_get_uid (device));
> -g_object_ref (device);
> -{
> -if
> (mm_plugin_manager_device_support_check_cancel (self->priv-
> >plugin_manager, device))
> -mm_dbg ("Device support check has been
> cancelled");
> -
> -/* The device may have already been removed from
> the tracking HT, we
> - * just try to remove it and if it fails, we
> ignore it */
> -mm_device_remove_modem (device);
> -g_hash_table_remove (self->priv->devices,
> mm_device_get_uid (device));
> -}
> -g_object_unref (device);
> +if (mm_plugin_manager_device_support_check_cancel
> (self->priv->plugin_manager, device))
> +mm_dbg ("Device support check has been
> cancelled");
> +
> +/* The device may have already been removed from the
> tracking HT, we
> + * just try to remove it and if it fails, we ignore
> it */
> +mm_device_remove_modem (device);
> +g_hash_table_remove (self->priv->devices,
> mm_device_get_uid (device));
>  }
> +g_object_unref (device);
>  }
>  
>  return;
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: 4G USB dongles known to work on Linux

2018-02-22 Thread Bjørn Mork
Henrique Ferreiro  writes:

> Hi! https://www.freedesktop.org/wiki/Software/ModemManager/SupportedDevices/
> looks
> quite outdated. Can anyone here recommend any 4G USB dongle which works
> reasonably well on Linux?

I guess this page became irrelevant because "all" 4G and 3G USB dongles
suddenly worked reasonably well on Linux. It should probably be replaced
by a page stating that fact(?)

I am sure there are exceptions which do not work at all, but for some
years now these exceptions have been hard to find.  So maintaining a
list of supported devices doesn't make any sense.  They all work, more
or less.

*How* they work still differ though. As Aleksander and others have
mentioned, the trend seems go towards modems acting as mini-routers with
web based management.  The advantage is that it works the same
regardless of host OS.  The disadvantage is that you are limited by the
management web application built into the modem firmware.

The DDWRT guys have an extensive list of modems, which might give some
clue wrt which modems support QMI or MBIM based management:
https://www.dd-wrt.com/wiki/index.php/3G_/_3.5G

But the number of device and firmware combinations is so large that I
don't think it is possible to tell for sure without trying.

> In particular, does the Huawei E3372 or E8372 work? A quick google search
> returns mixed results.

They should work as well as any, as Thomas said.  Exactly how is
difficult to say without known the precise firmware configuration.  But
I am pretty sure you should be able to get an IPv4 Internet connection
going without much trouble.


Bjørn
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel