All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmodem: Fix a race if a context get deactivated while read
@ 2019-05-08  7:27 richard.rojfors
  2019-05-08 14:41 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: richard.rojfors @ 2019-05-08  7:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

From: Richard Röjfors <richard@puffinpack.se>

When a context gets activated we read its settings, but
if the context gets deactivated during this time we should
not indicate that the context is activated when the settings
are received.
---
 drivers/atmodem/gprs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index d3fd893c..dd734585 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -161,6 +161,11 @@ static void at_cgdcont_read_cb(gboolean ok, GAtResult *result,
 		return;
 	}
 
+	if (gd->last_auto_context_id == 0) {
+		DBG("Context got deactivated while calling CGDCONT");
+		return;
+	}
+
 	g_at_result_iter_init(&iter, result);
 
 	while (g_at_result_iter_next(&iter, "+CGDCONT:")) {
@@ -251,6 +256,12 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
 
 		g_at_chat_send(gd->chat, "AT+CGDCONT?", cgdcont_prefix,
 				at_cgdcont_read_cb, gprs, NULL);
+	} else if (g_str_has_prefix(event, "ME PDN DEACT")) {
+		unsigned int context_id;
+		sscanf(event, "%*s %*s %*s %u", &context_id);
+		/* Indicate that this cid is not activated anymore */
+		if (gd->last_auto_context_id == context_id)
+			gd->last_auto_context_id = 0;
 	}
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] atmodem: Fix a race if a context get deactivated while read
  2019-05-08  7:27 [PATCH] atmodem: Fix a race if a context get deactivated while read richard.rojfors
@ 2019-05-08 14:41 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2019-05-08 14:41 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

Hi Richard,

On 05/08/2019 02:27 AM, richard.rojfors(a)gmail.com wrote:
> From: Richard Röjfors <richard@puffinpack.se>
> 
> When a context gets activated we read its settings, but
> if the context gets deactivated during this time we should
> not indicate that the context is activated when the settings
> are received.
> ---
>   drivers/atmodem/gprs.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 

Applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-08 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08  7:27 [PATCH] atmodem: Fix a race if a context get deactivated while read richard.rojfors
2019-05-08 14:41 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.