tee-supplicant: close shm fd before freeing memory

The resources of a shm is released in process_free(), this includes the
file descriptor and the memory buffer which was registered. Closing
the file descriptor unregisters the memory buffer.

The memory buffer was, prior to this patch, freed before the file
descriptor was closed. This could lead to another thread reusing this
memory buffer before it has been unregistered. This is normally not a
problem since the buffer will not be read or modified after it has been
freed. However, FF-A mandates that a physical memory isn't registered
already when registering. Son in the case we can have occasional failures.

Fixes: 075c56eebdc9 ("tee_supplicant: add register memory feature")
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
1 file changed
tree: 413f7f0ee72c124fe22b5076839daf4d1920d83a
  1. .github/
  2. libckteec/
  3. libseteec/
  4. libteec/
  5. public/
  6. scripts/
  7. tee-supplicant/
  8. .gitattributes
  9. .gitignore
  10. .travis.yml
  11. Android.mk
  12. android_flags.mk
  13. CMakeLists.txt
  14. CMakeToolchain.txt
  15. config.mk
  16. flags.mk
  17. LICENSE
  18. Makefile
  19. README.md
  20. typedefs.checkpatch
README.md

OP-TEE Client API

This git contains source code for the non-secure side implementation of the OP-TEE project making up the client library and tee-supplicant.

All official OP-TEE documentation has moved to http://optee.readthedocs.io. The information that used to be here in this git can be found under optee_client.

// OP-TEE core maintainers