misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe()
[ Upstream commit0978de9fc7
] 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:278d56f970
("misc: fastrpc: Reference count channel context") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20200511162722.2552-1-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c2ff1fcc25
commit
8d8991bb2b
|
@ -1434,8 +1434,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
|
|||
domains[domain_id]);
|
||||
data->miscdev.fops = &fastrpc_fops;
|
||||
err = misc_register(&data->miscdev);
|
||||
if (err)
|
||||
if (err) {
|
||||
kfree(data);
|
||||
return err;
|
||||
}
|
||||
|
||||
kref_init(&data->refcount);
|
||||
|
||||
|
|
Loading…
Reference in New Issue