Commit b85f6b60 authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Bjorn Andersson

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.

Fixes: 933b45da ("rpmsg: glink: Add support for TX intents")
Cc: stable@vger.kernel.org
Acked-By: default avatarChris Lew <clew@codeaurora.org>
Tested-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
Reported-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 4623e8bf
...@@ -241,10 +241,19 @@ static void qcom_glink_channel_release(struct kref *ref) ...@@ -241,10 +241,19 @@ 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;
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment