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

Commit 4d6adfd3 authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Sathish Ambley
Browse files

msm: ADSPRPC: Validate channel status before write



Make sure that the channel is not closed before attempting
to write to the SMD channel.

Change-Id: I4ff4f57159c163ab4d330dbf4634ebf0b50931a2
Acked-by: default avatarSathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 88596d4c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -963,6 +963,10 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
	struct smq_msg msg;
	struct fastrpc_file *fl = ctx->fl;
	int err = 0, len;

	VERIFY(err, 0 != fl->apps->channel[fl->cid].chan);
	if (err)
		goto bail;
	msg.pid = current->tgid;
	msg.tid = current->pid;
	if (kernel)
@@ -976,6 +980,7 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
	len = smd_write(fl->apps->channel[fl->cid].chan, &msg, sizeof(msg));
	spin_unlock(&fl->apps->hlock);
	VERIFY(err, len == sizeof(msg));
 bail:
	return err;
}