From: Yuanhan Liu Date: Mon, 27 Mar 2017 08:52:15 +0000 (+0800) Subject: vhost: fix fd leaks for vhost-user server mode X-Git-Tag: spdx-start~3900 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=65388b43f592e16497af48db69ad5063d6824daf;hp=65388b43f592e16497af48db69ad5063d6824daf;p=dpdk.git vhost: fix fd leaks for vhost-user server mode A vhost-user server socket could have many connections, thus many connfd. However, we currently just use one single int var to store it. Meaning, it will get overwritten every time a new connection is created. While this will not create fatal issue as it sounds (since the correct connfd is closured to the event loop thread by fdset_add), it may cause fd leaks if a user invokes rte_vhost_driver_unregister before shutting down all connections: it just closes the recent connfd. A simple example that should be able to reproduce this leaks issues is, del the ovs vhost-user port while the connected VMs are still alive. (Note that it's suggested to use one socket for one VM, which makes the issue not that fatal as it sounds again). Since we already use a struct "vhost_user_connection" to track all info about one connection, it's obvious that we should put the connfd there. Then we could build a connection list inside the vhost_user_socket struct, to represent all connections belong that socket file. Fixes: 164fd396788d ("vhost: fix unregistering in client mode") Cc: stable@dpdk.org Cc: Ilya Maximets Signed-off-by: Yuanhan Liu ---