misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe()
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 11 May 2020 16:27:22 +0000 (17:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:13 +0000 (17:50 +0200)
commit8d8991bb2bf042d46fe277d7a52adccdfc98b8eb
tree5c0c26f21393e4027c32ac33938838fdd089242e
parentc2ff1fcc2530a4e7bd2d7d660661dae3216681a9
misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe()

[ Upstream commit 0978de9fc7335c73934ab8fac189fb4cb3f23191 ]

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: 278d56f970ae ("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>
drivers/misc/fastrpc.c