T258: caps_lookup_slot: return SYS_ERR_CNODE_NOT_FOUND when encountering null cnode...
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Wed, 10 Aug 2016 14:59:25 +0000 (16:59 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Wed, 10 Aug 2016 14:59:25 +0000 (16:59 +0200)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

errors/errno.fugu
kernel/capabilities.c

index 94b43a8..51cb292 100755 (executable)
@@ -43,6 +43,7 @@ errors kernel SYS_ERR_ {
     failure IDC_MSG_BOUNDS      "Attempted to retrieve a word beyond the size of an LMP message structure",
 
     // Generic CSpace lookup errors
+    failure CNODE_NOT_FOUND     "Encountered null capability when resolving slot",
     failure CNODE_TYPE          "Encountered non-CNode capability when resolving slot",
     failure CNODE_RIGHTS        "Insufficient rights on CNode",
     failure DEPTH_EXCEEDED      "Exceeded depth limit of CSpace",
index d2f4377..4865491 100644 (file)
@@ -1140,6 +1140,12 @@ errval_t caps_lookup_slot(struct capability *rootcn, capaddr_t cptr,
         return SYS_ERR_OK;
     }
 
+    // L2 CNode in given L1 slot does not exist
+    if (l2cnode->cap.type == ObjType_Null) {
+        TRACE(KERNEL, CAP_LOOKUP_SLOT, 1);
+        debug(SUBSYS_CAPS, "%s: l2cnode is NULL\n", __FUNCTION__);
+        return SYS_ERR_CNODE_NOT_FOUND;
+    }
     if (l2cnode->cap.type != ObjType_L2CNode) {
         TRACE(KERNEL, CAP_LOOKUP_SLOT, 1);
         debug(SUBSYS_CAPS, "%s: l2cnode->type = %d\n", __FUNCTION__,