net/virtio: handle virtio-user setup failure properly
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 26 Jan 2021 10:16:39 +0000 (11:16 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:09 +0000 (18:16 +0100)
commit2e4c1b50d4a3fbfb5f59fdbeed6e10c1d3761cc2
treef3d2c75e9c60dd52b5f95c6572455ad69414d5ba
parent432a195f096851f7ff539b07953ee1bb0b208d3d
net/virtio: handle virtio-user setup failure properly

This patch fixes virtio_user_dev_setup() error path,
by cleaning all resources it allocates. It introduces
virtio_user_dev_uninit_notify() that cleans all open
FDs. It implies assigning all FDs to -1 at init time.

With these changes done, virtio_user_dev_init_notify()
can be simplified.

Suggested-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
drivers/net/virtio/virtio_user/virtio_user_dev.c