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

Commit 88a25d23 authored by Yan He's avatar Yan He Committed by Gerrit - the friendly Code Review server
Browse files

msm: sps: avoid accessing resources released by pipe disconnect



Client driver may have pipe connect and disconnect at the same
time. Adjust the locking location to avoid resource access in pipe
connect when pipe disconnect happens in parallel.

Change-Id: I76b5ab67516195709f634b6a536a0d02354960e1
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent cc0af699
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1326,6 +1326,7 @@ int sps_connect(struct sps_pipe *h, struct sps_connect *connect)
		goto exit_err;
	}

	mutex_lock(&bam->lock);
	SPS_DBG2("sps:sps_connect: bam %pa src 0x%lx dest 0x%lx mode %s",
			BAM_ID(bam),
			connect->source,
@@ -1334,14 +1335,13 @@ int sps_connect(struct sps_pipe *h, struct sps_connect *connect)

	/* Allocate resources for the specified connection */
	pipe->connect = *connect;
	mutex_lock(&bam->lock);
	result = sps_rm_state_change(pipe, SPS_STATE_ALLOCATE);
	if (result) {
		mutex_unlock(&bam->lock);
	if (result)
		goto exit_err;
	}

	/* Configure the connection */
	mutex_lock(&bam->lock);
	result = sps_rm_state_change(pipe, SPS_STATE_CONNECT);
	mutex_unlock(&bam->lock);
	if (result) {