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: Arun Kumar Neelakantam <aneela@codeaurora.org>
This commit is contained in:
Arun Kumar Neelakantam 2018-10-25 16:45:36 +05:30 committed by Chris Lew
parent 424874ce43
commit 91cffe5a75

View file

@ -285,13 +285,22 @@ static void qcom_glink_channel_release(struct kref *ref)
{
struct glink_channel *channel = container_of(ref, struct glink_channel,
refcount);
struct glink_core_rx_intent *tmp;
unsigned long flags;
int iid;
CH_INFO(channel, "\n");
wake_up(&channel->intent_req_event);
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_for_each_entry(&channel->riids, tmp, iid)
kfree(tmp);
idr_destroy(&channel->riids);
spin_unlock_irqrestore(&channel->intent_lock, flags);