From e34f5b118b7400d987ecae1f3b53eca27074d279 Mon Sep 17 00:00:00 2001 From: Thanos Makatos Date: Fri, 27 Nov 2020 11:45:18 -0500 Subject: don't leak passed file descriptors on failure Signed-off-by: Thanos Makatos --- lib/private.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/private.h') diff --git a/lib/private.h b/lib/private.h index 7ffe099..22c6807 100644 --- a/lib/private.h +++ b/lib/private.h @@ -47,7 +47,7 @@ struct transport_ops { int (*attach)(vfu_ctx_t*); int(*detach)(vfu_ctx_t*); int (*get_request)(vfu_ctx_t*, struct vfio_user_header*, - int *fds, int *nr_fds); + int *fds, size_t *nr_fds); }; typedef enum { @@ -143,13 +143,26 @@ region_to_offset(uint32_t region); int handle_dma_map_or_unmap(vfu_ctx_t *vfu_ctx, uint32_t size, bool map, - int *fds, int nr_fds, + int *fds, size_t *nr_fds, struct vfio_user_dma_region *dma_regions); void _dma_controller_do_remove_region(dma_controller_t *dma, dma_memory_region_t *region); +int +get_next_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, int *fds, + size_t *nr_fds); + +int +exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, size_t size, + int *fds, size_t *nr_fds, + struct iovec *_iovecs, struct iovec **iovecs, size_t *nr_iovecs, + bool *free_iovec_data); + +int +process_request(vfu_ctx_t *vfu_ctx); + #endif /* LIB_VFIO_USER_PRIVATE_H */ /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.1