1.1 --- a/libipc/lib/src/cap_alloc.c Tue Dec 12 19:16:00 2023 +0100
1.2 +++ b/libipc/lib/src/cap_alloc.c Tue Dec 12 19:16:58 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Capability allocation and management.
1.6 *
1.7 - * Copyright (C) 2019, 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2019, 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -20,7 +20,9 @@
1.13 */
1.14
1.15 #include <l4/re/c/util/cap_alloc.h>
1.16 +#include <l4/re/consts.h>
1.17 #include <l4/sys/err.h>
1.18 +#include <l4/sys/task.h>
1.19
1.20 #include "cap_alloc.h"
1.21 #include "semaphore.h"
1.22 @@ -115,7 +117,14 @@
1.23 if (err)
1.24 return 0;
1.25
1.26 - l4re_util_cap_free_um(cap);
1.27 + l4re_util_cap_free(cap);
1.28 +
1.29 + /* Do the unmapping separately since the capability may not actually be
1.30 + managed by the capability allocator if, for example, obtained from the
1.31 + environment. */
1.32 +
1.33 + l4_task_unmap(L4RE_THIS_TASK_CAP, l4_obj_fpage(cap, 0, L4_CAP_FPAGE_RWSD),
1.34 + L4_FP_ALL_SPACES);
1.35
1.36 ipc_semaphore_up(ipc_cap_alloc_semaphore);
1.37