From: John Hodge Date: Sun, 20 Jun 2010 09:28:50 +0000 (+0800) Subject: Fixing a kernel #PF caused by an unitialised VFS method X-Git-Tag: rel0.06~137 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7c2a4b6359a81dac11d89eda748d1cc0640f6d33;p=tpg%2Facess2.git Fixing a kernel #PF caused by an unitialised VFS method --- diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index 04facc7d..552276d9 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -652,6 +652,14 @@ void VFS_Close(int FD) return; } + #if VALIDATE_VFS_FUNCTIPONS + if(h->Node->Close && !MM_GetPhysAddr(h->Node->Close)) { + Log_Warning("VFS", "Node %p's ->Close method is invalid (%p)", + h->Node, h->Node->Close); + return ; + } + #endif + if(h->Node->Close) h->Node->Close( h->Node ); diff --git a/Modules/IPStack/main.c b/Modules/IPStack/main.c index 6b75b770..da7441c4 100644 --- a/Modules/IPStack/main.c +++ b/Modules/IPStack/main.c @@ -122,6 +122,11 @@ char *IPStack_Root_ReadDir(tVFS_Node *Node, int Pos) } name = malloc(4); + if(!name) { + Log_Warning("IPStack", "IPStack_Root_ReadDir - malloc error"); + LEAVE('n'); + return NULL; + } // Create the name Pos = iface->Node.ImplInt; @@ -535,6 +540,10 @@ int IPStack_AddInterface(char *Device) iface->Node.ReadDir = IPStack_Iface_ReadDir; iface->Node.FindDir = IPStack_Iface_FindDir; iface->Node.IOCtl = IPStack_Iface_IOCtl; + iface->Node.MkNod = NULL; + iface->Node.Link = NULL; + iface->Node.Relink = NULL; + iface->Node.Close = NULL; // Set Defaults iface->TimeoutDelay = DEFAULT_TIMEOUT;