Re: [MM] [PATCH v2] iface-modem: fix crashes due to removed context



On 08/01/2012 08:53 PM, Ben Chan wrote:
> ---
> The issue doesn't seem to affect update_signa_quality.


Pushed this patch now, thanks!

Updating signal quality or access tech values would really be affected.
If the interface is shutdown while we're waiting the reply to the AT
command, we would end up calling update_access_technologies() or
update_signal_quality() to an interface which has a NULL skeleton. I
pushed a fix that is a bit more generic than this specific case of
detecting a NULL ctx:
http://cgit.freedesktop.org/ModemManager/ModemManager/commit/?id=0336b8f89d83998323643e5db8478590f310c256

Cheers!

> 
>  src/mm-iface-modem.c |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
> index e3165f2..f0fbb82 100644
> --- a/src/mm-iface-modem.c
> +++ b/src/mm-iface-modem.c
> @@ -591,9 +591,12 @@ access_technologies_check_ready (MMIfaceModem *self,
>      } else
>          mm_iface_modem_update_access_technologies (self, access_technologies, mask);
>  
> -    /* Remove the running tag */
> +    /* Remove the running tag. Note that the context may have been removed by
> +     * mm_iface_modem_shutdown when this function is invoked as a callback of
> +     * load_access_technologies. */
>      ctx = g_object_get_qdata (G_OBJECT (self), access_technologies_check_context_quark);
> -    ctx->running = FALSE;
> +    if (ctx)
> +        ctx->running = FALSE;
>  }
>  
>  static gboolean
> @@ -843,9 +846,12 @@ signal_quality_check_ready (MMIfaceModem *self,
>      } else
>          update_signal_quality (self, signal_quality, TRUE);
>  
> -    /* Remove the running tag */
> +    /* Remove the running tag. Note that the context may have been removed by
> +     * mm_iface_modem_shutdown when this function is invoked as a callback of
> +     * load_signal_quality. */
>      ctx = g_object_get_qdata (G_OBJECT (self), signal_quality_check_context_quark);
> -    ctx->running = FALSE;
> +    if (ctx)
> +        ctx->running = FALSE;
>  }
>  
>  static gboolean
> 


-- 
Aleksander


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