xen/arm: optee: fix possible memory leaks
authorVolodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Thu, 7 Oct 2021 23:25:02 +0000 (23:25 +0000)
committerStefano Stabellini <stefano.stabellini@xilinx.com>
Fri, 8 Oct 2021 23:02:13 +0000 (16:02 -0700)
commit664cc3c3d381e4f9a61dcb68cbd7a6a00070370e
treed457f5cec2cb0bfe70347346dd43ee465941e5e3
parentd4c9845e52cbb3cd62172809f62ee51dbb3ca7de
xen/arm: optee: fix possible memory leaks

translate_noncontig() allocates domheap page for translated list
before calling to allocate_optee_shm_buf(), which can fail for number
of reason. Anyways, after fail we need to free the allocated page(s).

Another leak is possible if the same translate_noncontig() function
fails to get domain page. In this case it should free allocated
optee_shm_buf prior exit. This will also free allocated domheap page.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/tee/optee.c