Re: [PATCHv2] gatmux: take reference to mux object while processing incoming data

2019-10-07 Thread Denis Kenzior
Hi Martin, @@ -646,13 +653,6 @@ void g_at_mux_unref(GAtMux *mux) } } -static void read_watcher_destroy_notify(gpointer user_data) -{ - GAtMux *mux = user_data; - - mux->read_watch = 0; -} - gboolean g_at_mux_start(GAtMux *mux) { if (mux->channel == NULL) @@

Re: [PATCH] gatmux: don't free cmux data until watchers are destroyed

2019-10-07 Thread Denis Kenzior
Hi Martin, On 10/7/19 1:37 PM, Martin Hundebøll wrote: Why not do something like: g_at_mux_ref(mux); for (i = 1; i <= MAX_CHANNELS && !mux->shutdown; i++) { int offset = i / 8; int bit = i % 8;    

[PATCHv3 2/2] quectel: support own cmux implementation over kernel line discipline

2019-10-07 Thread Martin Hundebøll
The in-kernel implementation of gsm0710 causes deadlocks in the kernel[1], so switch the default back to the user-space implementation in ofono. The change also removes the timeout-callback used to defer disabling the n_gsm line discipline, as that is no longer needed[2] To enable use of the

[PATCHv3 1/2] quectel: rework sim detection

2019-10-07 Thread Martin Hundebøll
Use at_util_sim_state_query_new() to query the sim inserted state. Once that returns, the locked state is queried by issuing a AT+CPIN? command. If not locked, a timer is started to query the quectel init status of the sim. Once the init status is ready, the sim atom is created, and the modem is

Re: [PATCH] gatmux: don't free cmux data until watchers are destroyed

2019-10-07 Thread Martin Hundebøll
On 30/09/2019 22.59, Denis Kenzior wrote: Hi Martin, @@ -227,12 +227,15 @@ static void dispatch_sources(GAtMuxChannel *channel, GIOCondition condition)   static gboolean received_data(GIOChannel *channel, GIOCondition cond,   gpointer data)   { -    GAtMux *mux =

[PATCHv2] gatmux: take reference to mux object while processing incoming data

2019-10-07 Thread Martin Hundebøll
When closing down a cmux object, the address sanitizer detects a use-after-free in gatmux.c (see below). Avoid this by taking a reference to the mux object during the processing in received_data(). ofonod[3640549]: ../git/plugins/quectel.c:cfun_disable() 0x61000b40 ofonod[3640549]:

Re: [PATCH] gatmux: don't free cmux data until watchers are destroyed

2019-10-07 Thread Martin Hundebøll
On 07/10/2019 20.37, Martin Hundebøll wrote: Why not do something like: g_at_mux_ref(mux); for (i = 1; i <= MAX_CHANNELS && !mux->shutdown; i++) { int offset = i / 8; int bit = i % 8; if

Re: [PATCH] gatmux: don't free cmux data until watchers are destroyed

2019-10-07 Thread Martin Hundebøll
Hi Denis, On 30/09/2019 22.59, Denis Kenzior wrote: @@ -227,12 +227,15 @@ static void dispatch_sources(GAtMuxChannel *channel, GIOCondition condition)   static gboolean received_data(GIOChannel *channel, GIOCondition cond,   gpointer data)   { -    GAtMux *mux =