Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f5b71b2 authored by Eric Holmberg's avatar Eric Holmberg
Browse files

soc: qcom: smd: add state check for re-open



A race condition exists if an SMD channel is closed in response to a
remote close followed by a client close and then an immediate re-open.
In this case, if the remote system is busy, it may miss the closing
transition and just see an OPENED->OPENING transition which is invalid.

Add a check when opening a channel to make sure that the remote side has
seen our CLOSED state before we allow a transition to OPENING.

CRs-Fixed: 764856
Change-Id: I3448a6fa96032437346bbbf86b99ca99db5965e1
Signed-off-by: default avatarEric Holmberg <eholmber@codeaurora.org>
parent cb0b4937
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2026,6 +2026,16 @@ int smd_named_open_on_edge(const char *name, uint32_t edge,
			return -ENODEV;
	}

	if (ch->half_ch->get_fSTATE(ch->send)) {
		/* remote side hasn't acknowledged our last state transition */
		SMD_INFO("%s: ch %d valid, waiting for remote to ack state\n",
				__func__, ch->n);
		msleep(250);
		if (ch->half_ch->get_fSTATE(ch->send))
			SMD_INFO("%s: ch %d - no remote ack, continuing\n",
					__func__, ch->n);
	}

	if (notify == 0)
		notify = do_nothing_notify;