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

Commit 91cffe5a authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Chris Lew
Browse files

rpmsg: glink: Fix reuse intents memory leak issue



Memory allocated for re-usable intents are not freed during channel
cleanup which causes memory leak in system.

Check and free all re-usable memory to avoid memory leak.

CRs-Fixed: 2339489
Change-Id: I2a174aabfced05c165a1b342032926fbd8de70cb
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent 424874ce
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -285,13 +285,22 @@ static void qcom_glink_channel_release(struct kref *ref)
{
{
	struct glink_channel *channel = container_of(ref, struct glink_channel,
	struct glink_channel *channel = container_of(ref, struct glink_channel,
						     refcount);
						     refcount);
	struct glink_core_rx_intent *tmp;
	unsigned long flags;
	unsigned long flags;
	int iid;


	CH_INFO(channel, "\n");
	CH_INFO(channel, "\n");
	wake_up(&channel->intent_req_event);
	wake_up(&channel->intent_req_event);


	spin_lock_irqsave(&channel->intent_lock, flags);
	spin_lock_irqsave(&channel->intent_lock, flags);
	idr_for_each_entry(&channel->liids, tmp, iid) {
		kfree(tmp->data);
		kfree(tmp);
	}
	idr_destroy(&channel->liids);
	idr_destroy(&channel->liids);

	idr_for_each_entry(&channel->riids, tmp, iid)
		kfree(tmp);
	idr_destroy(&channel->riids);
	idr_destroy(&channel->riids);
	spin_unlock_irqrestore(&channel->intent_lock, flags);
	spin_unlock_irqrestore(&channel->intent_lock, flags);