Skip to contentSkip to conversation

gprs: Do nothing on detached when attaching.

PATCH Superseded [email protected] 2 participants 3 messages Sep 22, 2019 – Sep 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gprs: Do nothing on detached when attaching.

From: Richard Röjfors <[email protected]>

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(+)
src/gprs.c +9 -0
index c7b181f5..7d854fcf 100644
@@ -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);
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 gprs: Do nothing on detached when attaching.

From: Richard Röjfors <[email protected]>

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(+)
src/gprs.c +9 -0
index c7b181f5..7d854fcf 100644
@@ -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);
 
Signature · 1 line
2.20.1
#2 lore raw

Hi Richard,

Quoted 10 lines · richard.rojfors(a)gmail.com

From: Richard Röjfors <[email protected]>

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