ANDROID: gunyah: GKI: Avoid release the CMA memory when it's in use

One process boots up SVM, the CMA memory is allocated and used by SVM.
If another process try to boot up VM again, will allocate fail and
release this CMA memory region. It will cause kernel panic when one
process allocates memory from this CMA memory region due to not do
relciam parcel for this memory. Fix this issue by return a error in
gunyah_cma_create_mem_fd to avoid gunyah_cma_release is called when
the CMA memory region is already allocated by other process.

Bug: 432359620
Change-Id: Iee2d20d455e80d992db45c875488fd9cb631f8fd
Signed-off-by: Peng Yang <quic_penyan@quicinc.com>
This commit is contained in:
Peng Yang
2025-07-15 23:49:43 -07:00
committed by Treehugger Robot
parent b2a2ed8dce
commit 354fa5d5bf
+3
View File
@@ -257,6 +257,9 @@ static long gunyah_cma_create_mem_fd(struct gunyah_cma *cma)
struct file *file;
int fd, err;
if (cma->page)
return -EBUSY;
flags |= O_CLOEXEC;
fd = get_unused_fd_flags(flags);
if (fd < 0)