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

Commit 737c7353 authored by Deepak Kumar Singh's avatar Deepak Kumar Singh
Browse files

rpmsg: glink: check channel state before serving intent



Receive callback can be registered even before rpmsg driver probe is
complete. Assuming callback register as channel ready and allowing
remote host to send data is incorrect. In such case for any rx packet
callback may return prematurely thereby dropping the rx packet.

Adding a flag to store channel state when it is ready. Check this flag
before allocating rx intent and allowing data communication to proceed.
It will ensure that client driver is able to receive data correctly,
without any rx packet getting dropped.

CRs-Fixed: 2747216
Change-Id: Ib153cfe5689f31d7417622bf6177e9535fda628a
Signed-off-by: default avatarDeepak Kumar Singh <deesin@codeaurora.org>
parent 82e942f3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ struct glink_channel {

	struct mutex intent_req_lock;
	bool intent_req_result;
	bool channel_ready;
	atomic_t intent_req_comp;
	wait_queue_head_t intent_req_event;
};
@@ -911,7 +912,7 @@ static void qcom_glink_handle_intent_req(struct qcom_glink *glink,

	ept = &channel->ept;
	intent = qcom_glink_alloc_intent(glink, channel, size, false);
	if (intent && ept->cb)
	if (intent && channel->channel_ready)
		qcom_glink_advertise_intent(glink, channel, intent);

	qcom_glink_send_intent_req_ack(glink, channel, !!intent);
@@ -1424,6 +1425,8 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
	if (glink->intentless || !completion_done(&channel->open_ack))
		return 0;

	channel->channel_ready = true;

	/*Serve any pending intent request*/
	spin_lock_irqsave(&channel->intent_lock, flags);
	idr_for_each_entry(&channel->liids, tmp, iid) {