On 4/25/22 14:54, David Marchand wrote:
Some message handlers do not expect any file descriptor attached as
ancillary data.
Provide a common way to enforce this by adding a accepts_fd boolean in
the message handler structure. When a message handler sets accepts_fd to
true, it is responsible for calling validate_msg_fds with a right
expected file descriptor count.
This will avoid leaking some file descriptor by mistake when adding
support for new vhost user message types.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
  lib/vhost/vhost_user.c | 145 ++++++++++++-----------------------------
  1 file changed, 43 insertions(+), 102 deletions(-)


Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>

Thanks,
Maxime

Reply via email to