Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH] gprs: Do nothing on detached when attaching.
@ 2019-09-22 21:04 richard.rojfors
  2019-09-23  7:15 ` [PATCH v2] " richard.rojfors
  0 siblings, 1 reply; 3+ messages in thread
From: richard.rojfors @ 2019-09-22 21:04 UTC (permalink / raw)
  To: ofono

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

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

Its incorrect to fiddle with the driver attach state when
attaching. When attaching the state is transitioning,
and the correct state will not always be assigned in
the end of the attach process, regardless of result.
---
 src/gprs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/gprs.c b/src/gprs.c
index c7b181f5..7d854fcf 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -2551,6 +2551,15 @@ void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
 {
 	DBG("%s", __ofono_atom_get_path(gprs->atom));
 
+	/*
+	 * In case we are attaching let that finish, it will update to the
+	 * correct status. If we fiddle with driver_attach and the
+	 * attach fails, the code will invert back the state to attached,
+	 * which would leave us in an incorrect state.
+	 */
+	if (gprs->flags & GPRS_FLAG_ATTACHING)
+		return;
+
 	gprs->driver_attached = FALSE;
 	gprs_attached_update(gprs);
 
-- 
2.20.1


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

* [PATCH v2] gprs: Do nothing on detached when attaching.
  2019-09-22 21:04 [PATCH] gprs: Do nothing on detached when attaching richard.rojfors
@ 2019-09-23  7:15 ` richard.rojfors
  2019-09-24 14:55   ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: richard.rojfors @ 2019-09-23  7:15 UTC (permalink / raw)
  To: ofono

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

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

Its incorrect to fiddle with the driver attach state when
attaching. When attaching the state is transitioning,
and the correct state will now always be assigned in
the end of the attach process, regardless of result.
---
 src/gprs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/gprs.c b/src/gprs.c
index c7b181f5..7d854fcf 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -2551,6 +2551,15 @@ void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
 {
 	DBG("%s", __ofono_atom_get_path(gprs->atom));
 
+	/*
+	 * In case we are attaching let that finish, it will update to the
+	 * correct status. If we fiddle with driver_attach and the
+	 * attach fails, the code will invert back the state to attached,
+	 * which would leave us in an incorrect state.
+	 */
+	if (gprs->flags & GPRS_FLAG_ATTACHING)
+		return;
+
 	gprs->driver_attached = FALSE;
 	gprs_attached_update(gprs);
 
-- 
2.20.1


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

* Re: [PATCH v2] gprs: Do nothing on detached when attaching.
  2019-09-23  7:15 ` [PATCH v2] " richard.rojfors
@ 2019-09-24 14:55   ` Denis Kenzior
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-09-24 14:55 UTC (permalink / raw)
  To: ofono

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

Hi Richard,

On 9/23/19 2:15 AM, richard.rojfors(a)gmail.com wrote:
> From: Richard Röjfors <richard@puffinpack.se>
> 
> Its incorrect to fiddle with the driver attach state when
> attaching. When attaching the state is transitioning,
> and the correct state will now always be assigned in
> the end of the attach process, regardless of result.
> ---
>   src/gprs.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2019-09-24 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-22 21:04 [PATCH] gprs: Do nothing on detached when attaching richard.rojfors
2019-09-23  7:15 ` [PATCH v2] " richard.rojfors
2019-09-24 14:55   ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox