!132 VfsJffs2Lookup中VfsHashGet获取的vnode未判断data字段的有效性
Merge pull request !132 from zhangfanfan2/jffs2
This commit is contained in:
commit
ca41a70d7d
|
@ -574,12 +574,8 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
|
|||
PrintExcInfo("User mode exception ends unscheduled!\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is used to determine whether the first input parameter is a valid virtual address.
|
||||
* If it is, it is converted into a kernel virtual address and the converted kernel virtual address
|
||||
* is used as an output parameter.
|
||||
*/
|
||||
STATIC INLINE BOOL IsValidVaddr(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
|
||||
/* this function is used to validate fp or validate the checking range start and end. */
|
||||
STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
|
||||
{
|
||||
VADDR_T kvaddr = regFP;
|
||||
|
||||
|
@ -622,7 +618,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
|||
taskCB = OsCurrTaskGet();
|
||||
stackStart = taskCB->userMapBase;
|
||||
stackEnd = taskCB->userMapBase + taskCB->userMapSize;
|
||||
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
found = TRUE;
|
||||
goto FOUND;
|
||||
}
|
||||
|
@ -638,7 +634,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
|||
|
||||
stackStart = taskCB->topOfStack;
|
||||
stackEnd = taskCB->topOfStack + taskCB->stackSize;
|
||||
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
found = TRUE;
|
||||
goto FOUND;
|
||||
}
|
||||
|
@ -649,7 +645,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
|||
stack = &g_excStack[index];
|
||||
stackStart = (UINTPTR)stack->stackTop;
|
||||
stackEnd = stackStart + LOSCFG_KERNEL_CORE_NUM * stack->stackSize;
|
||||
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
found = TRUE;
|
||||
goto FOUND;
|
||||
}
|
||||
|
@ -685,23 +681,23 @@ VOID BackTraceSub(UINTPTR regFP)
|
|||
* will still be stored and updated. In that case we needs to find the right position of frame pointer.
|
||||
*/
|
||||
tmpFP = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
if (IsValidVaddr(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
|
||||
if (IsValidFP(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
|
||||
backFP = tmpFP;
|
||||
PrintExcInfo("traceback fp fixed, trace using fp = 0x%x\n", backFP);
|
||||
}
|
||||
|
||||
while (IsValidVaddr(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
tmpFP = backFP;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
if (IsValidVaddr(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
|
||||
return;
|
||||
}
|
||||
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
#else
|
||||
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
if (IsValidVaddr(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -202,6 +202,9 @@ int VfsJffs2Lookup(struct Vnode *parentVnode, const char *path, int len, struct
|
|||
(void)VfsHashGet(parentVnode->originMount, node->i_ino, &newVnode, NULL, NULL);
|
||||
LOS_MuxUnlock(&g_jffs2FsLock);
|
||||
if (newVnode) {
|
||||
if (newVnode->data == NULL) {
|
||||
LOS_Panic("#####VfsHashGet error#####\n");
|
||||
}
|
||||
*ppVnode = newVnode;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue