iommu: iommu-debug: Fix race with respect to test buffer allocation
When the buffer pointed to by test_virt_addr is allocated, there
is no synchronization with respect to checking if it is necessary
to allocate the buffer. This can lead to various adversarial
scenarios, where multiple concurrent allocations of the same
buffer can occur, resulting in memory leaks.
To avoid these scenarios, make the check and allocation of the
buffer atomic with respect to other accesses to test_virt_addr.
Change-Id: Ie7e05930042b0bbf4bec0a4f1f5b325970023a5a
Signed-off-by:
Isaac J. Manjarres <isaacm@codeaurora.org>
Loading
Please register or sign in to comment