[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191219182908.934128196@linuxfoundation.org>
Date: Thu, 19 Dec 2019 19:34:37 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Chris Lew <clew@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Arun Kumar Neelakantam <aneela@...eaurora.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>
Subject: [PATCH 4.14 20/36] rpmsg: glink: Fix reuse intents memory leak issue
From: Arun Kumar Neelakantam <aneela@...eaurora.org>
commit b85f6b601407347f5425c4c058d1b7871f5bf4f0 upstream.
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: 933b45da5d1d ("rpmsg: glink: Add support for TX intents")
Cc: stable@...r.kernel.org
Acked-By: Chris Lew <clew@...eaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@...eaurora.org>
Reported-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/rpmsg/qcom_glink_native.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -243,10 +243,19 @@ static void qcom_glink_channel_release(s
{
struct glink_channel *channel = container_of(ref, struct glink_channel,
refcount);
+ struct glink_core_rx_intent *tmp;
unsigned long flags;
+ int iid;
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);
Powered by blists - more mailing lists