From: Bjorn Andersson <quic_bjorande@xxxxxxxxxxx> 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@xxxxxxxxxxx> Signed-off-by: Bjorn Andersson <quic_bjorande@xxxxxxxxxxx> Signed-off-by: Bjorn Andersson <andersson@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230109223931.1706429-1-quic_bjorande@xxxxxxxxxxx (cherry picked from commit fb80ef67e8ff6a00d3faad4cb348dafdb8eccfd8) Signed-off-by: Lee Jones <lee@xxxxxxxxxx> --- drivers/rpmsg/qcom_glink_native.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index c1dfad2986859..8ee814d6dddce 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1354,6 +1354,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); } -- 2.42.0.820.g83a721a137-goog