summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Andersson <quic_bjorande@quicinc.com>2023-10-31 11:33:53 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-08 17:30:47 +0100
commit41c13a571de449a94c92a68eac5b92a8860d5cc6 (patch)
treee9887ab76c6d29b91822564fd4c30ee9c071cd85
parent5f1bb9f4d4b55c39180329c4e379aa740039eed3 (diff)
downloadlinux-stable-41c13a571de449a94c92a68eac5b92a8860d5cc6.tar.gz
linux-stable-41c13a571de449a94c92a68eac5b92a8860d5cc6.tar.bz2
linux-stable-41c13a571de449a94c92a68eac5b92a8860d5cc6.zip
rpmsg: glink: Release driver_override
commit fb80ef67e8ff6a00d3faad4cb348dafdb8eccfd8 upstream. Upon termination of the rpmsg_device, driver_override needs to be freed to avoid leaking the potentially assigned string. Fixes: 42cd402b8fd4 ("rpmsg: Fix kfree() of static memory on setting driver_override") Fixes: 39e47767ec9b ("rpmsg: Add driver_override device attribute for rpmsg_device") Reviewed-by: Chris Lew <quic_clew@quicinc.com> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230109223931.1706429-1-quic_bjorande@quicinc.com Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/rpmsg/qcom_glink_native.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index e776d1bfc976..28b6ae0e1a2f 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1379,6 +1379,7 @@ static void qcom_glink_rpdev_release(struct device *dev)
struct glink_channel *channel = to_glink_channel(rpdev->ept);
channel->rpdev = NULL;
+ kfree(rpdev->driver_override);
kfree(rpdev);
}
@@ -1607,6 +1608,7 @@ static void qcom_glink_device_release(struct device *dev)
/* Release qcom_glink_alloc_channel() reference */
kref_put(&channel->refcount, qcom_glink_channel_release);
+ kfree(rpdev->driver_override);
kfree(rpdev);
}