From ed54dca3ba06938787d31ff59c44335041a6d58f Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 30 Apr 2026 19:12:47 +0100 Subject: [PATCH] syscall: handle: fix lock-related bugs --- syscall/handle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syscall/handle.c b/syscall/handle.c index 3b75134..65e78c4 100644 --- a/syscall/handle.c +++ b/syscall/handle.c @@ -61,6 +61,7 @@ kern_status_t sys_kern_handle_transfer( src_task = task_cast(obj); if (!src_task) { status = KERN_INVALID_ARGUMENT; + task_unlock_irqrestore(self, flags); goto cleanup; } } else { @@ -81,6 +82,7 @@ kern_status_t sys_kern_handle_transfer( dest_task = task_cast(obj); if (!dest_task) { status = KERN_INVALID_ARGUMENT; + task_unlock_irqrestore(self, flags); goto cleanup; } } else { @@ -92,12 +94,12 @@ kern_status_t sys_kern_handle_transfer( src_handle, &src_object, &handle_flags); + task_unlock_irqrestore(self, flags); + if (status != KERN_OK) { goto cleanup; } - task_unlock_irqrestore(self, flags); - struct handle *dest = NULL; task_lock_irqsave(dest_task, &flags); status = handle_table_alloc_handle(