From c8202c6741707afb979033f888652eb83dbb201e Mon Sep 17 00:00:00 2001 From: Max Wash Date: Wed, 1 Apr 2026 18:35:08 +0100 Subject: [PATCH] vm: controller: implement detach of vm-object whose attachment was deferred --- vm/vm-controller.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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;