内存泄漏、访问野指针以及竞态问题修复。
This commit is contained in:
parent
67a9c7b8b5
commit
02788cedc0
|
@ -751,6 +751,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB)
|
|||
|
||||
space = processCB->vmSpace;
|
||||
if (space != NULL) {
|
||||
(VOID)LOS_MuxAcquire(&space->regionMux);
|
||||
/* free the regions associated with filep */
|
||||
RB_SCAN_SAFE(&space->regionRbTree, pstRbNode, pstRbNodeTmp)
|
||||
region = (LosVmMapRegion *)pstRbNode;
|
||||
|
@ -764,6 +765,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB)
|
|||
}
|
||||
}
|
||||
RB_SCAN_SAFE_END(&space->regionRbTree, pstRbNode, pstRbNodeTmp)
|
||||
(VOID)LOS_MuxRelease(&space->regionMux);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -698,7 +698,7 @@ STATUS_T OsVmRegionAdjust(LosVmSpace *space, VADDR_T newRegionStart, size_t size
|
|||
}
|
||||
}
|
||||
|
||||
region = LOS_RegionFind(space, nextRegionBase);
|
||||
region = LOS_RegionFind(space, nextRegionBase - 1);
|
||||
if ((region != NULL) && (nextRegionBase < LOS_RegionEndAddr(region))) {
|
||||
newRegion = OsVmRegionSplit(region, nextRegionBase);
|
||||
if (newRegion == NULL) {
|
||||
|
@ -726,6 +726,9 @@ STATUS_T OsRegionsRemove(LosVmSpace *space, VADDR_T regionBase, size_t size)
|
|||
|
||||
RB_SCAN_SAFE(&space->regionRbTree, pstRbNodeTemp, pstRbNodeNext)
|
||||
regionTemp = (LosVmMapRegion *)pstRbNodeTemp;
|
||||
if (regionTemp->range.base > regionEnd) {
|
||||
break;
|
||||
}
|
||||
if (regionBase <= regionTemp->range.base && regionEnd >= LOS_RegionEndAddr(regionTemp)) {
|
||||
status = LOS_RegionFree(space, regionTemp);
|
||||
if (status != LOS_OK) {
|
||||
|
@ -734,9 +737,6 @@ STATUS_T OsRegionsRemove(LosVmSpace *space, VADDR_T regionBase, size_t size)
|
|||
}
|
||||
}
|
||||
|
||||
if (regionTemp->range.base > regionEnd) {
|
||||
break;
|
||||
}
|
||||
RB_SCAN_SAFE_END(&space->regionRbTree, pstRbNodeTemp, pstRbNodeNext)
|
||||
|
||||
ERR_REGION_SPLIT:
|
||||
|
|
Loading…
Reference in New Issue