diff --git a/vm/vm-controller.c b/vm/vm-controller.c index 82fef0e..12ce88b 100644 --- a/vm/vm-controller.c +++ b/vm/vm-controller.c @@ -216,6 +216,15 @@ kern_status_t vm_controller_detach_object( return KERN_INVALID_ARGUMENT; } + if (vmo->vo_key == 0) { + /* this vmo isn't actually attached to this controller yet. + * this can happen if a controller-attached vmo was duplicated + * via copy-on-write, and the duplicate vmo has not yet been + * accessed. */ + vmo->vo_ctrl = NULL; + return KERN_OK; + } + struct page_request *req = vm_cache_alloc(&page_request_cache, VM_NORMAL); req->req_type = PAGE_REQUEST_DETACH;