Przeglądaj źródła

msm: camera: memmgr: fix lack of condition lead to memory leak

When multi map fails, the first mapping does not unmap
due to lack of condition.

CRs-Fixed: 2768768
Change-Id: Ib61ce8f5a73e5c27b1b19bbd23d6649c62feb0da
Signed-off-by: zhuo <[email protected]>
zhuo 4 lat temu
rodzic
commit
334028442c
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      drivers/cam_req_mgr/cam_mem_mgr.c

+ 2 - 2
drivers/cam_req_mgr/cam_mem_mgr.c

@@ -626,10 +626,10 @@ static int cam_mem_util_map_hw_va(uint32_t flags,
 	return rc;
 multi_map_fail:
 	if (flags & CAM_MEM_FLAG_PROTECTED_MODE)
-		for (--i; i > 0; i--)
+		for (--i; i >= 0; i--)
 			cam_smmu_unmap_stage2_iova(mmu_hdls[i], fd);
 	else
-		for (--i; i > 0; i--)
+		for (--i; i >= 0; i--)
 			cam_smmu_unmap_user_iova(mmu_hdls[i],
 				fd,
 				CAM_SMMU_REGION_IO);