]> git.droids-corp.org - dpdk.git/commit
vhost: validate FDs attached to messages
authorDavid Marchand <david.marchand@redhat.com>
Mon, 25 Apr 2022 12:54:30 +0000 (14:54 +0200)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Mon, 9 May 2022 19:39:58 +0000 (21:39 +0200)
commit09c28563015d5564be8599f8370246c865c2d514
treed434a96caebaf8c5c0b7ec18a87be3c739aae611
parente4b12ba5d51840ded98f01a0a973380f6e4cce58
vhost: validate FDs attached to messages

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.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/vhost/vhost_user.c