misc: fastrpc: Fix a possible double free
authorThierry Escande <thierry.escande@linaro.org>
Thu, 7 Mar 2019 10:12:23 +0000 (10:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 17:09:57 +0000 (02:09 +0900)
commitb49f6d83e290f17e20f4e5cf31288d3bb4955ea6
tree048308c30dc6a7b47283bcf32febb4a8cd24183d
parent8e7389c79b40ed44c855193bfb46b496ac25676f
misc: fastrpc: Fix a possible double free

This patch fixes the error exit path of fastrpc_init_create_process().
If the DMA allocation or the DSP invoke fails the fastrpc_map was freed
but not removed from the mapping list leading to a double free once the
mapping list is emptied in fastrpc_device_release().

[srinivas kandagatla]: Cleaned up error path labels and reset init mem
to NULL after free
Fixes: d73f71c7c6ee("misc: fastrpc: Add support for create remote init process")
Signed-off-by: Thierry Escande <thierry.escande@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/fastrpc.c