Commit 0978de9f authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Greg Kroah-Hartman

misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe()

fastrpc_channel_ctx is not freed if misc_register() fails, this would
lead to a memory leak. Fix this leak by adding kfree in misc_register()
error path.

Fixes: 278d56f9 ("misc: fastrpc: Reference count channel context")
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200511162722.2552-1-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 01360857
...@@ -1613,8 +1613,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) ...@@ -1613,8 +1613,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
domains[domain_id]); domains[domain_id]);
data->miscdev.fops = &fastrpc_fops; data->miscdev.fops = &fastrpc_fops;
err = misc_register(&data->miscdev); err = misc_register(&data->miscdev);
if (err) if (err) {
kfree(data);
return err; return err;
}
kref_init(&data->refcount); kref_init(&data->refcount);
......
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