> On 1 Feb 2023, at 13:29, Andrew Cooper <[email protected]> wrote:
>
> All caml_alloc_*() functions can throw exceptions, and longjump out of
> context. If this happens, we leak the xch/xce handle.
>
> Reorder the logic to allocate the the Ocaml object first.
>
> Fixes: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix
> use-after-free")
> Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential
> resource leak")
> Signed-off-by: Andrew Cooper <[email protected]>
> ---
> CC: Christian Lindig <[email protected]>
> CC: David Scott <[email protected]>
> CC: Edwin Török <[email protected]>
> CC: Rob Hoes <[email protected]>
> ---
> tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 6 ++++--
> tools/ocaml/libs/xc/xenctrl_stubs.c | 3 ++-
> 2 files changed, 6 insertions(+), 3 deletions(-)
Acked-by: Christian Lindig <[email protected]>