vhost: fix crash on closing in client mode
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Fri, 27 Apr 2018 15:19:44 +0000 (08:19 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:30:48 +0000 (22:30 +0100)
commit52d874dc67055a943867456d3e5c730168bfba18
treef6bd76af10c9f45d2240f7e4608c5954f32ec9f9
parent8b4b949144b80cc7312bbc189d38a3feaf2c74e5
vhost: fix crash on closing in client mode

when rte_vhost_driver_unregister detstroy the vsocket, we
should set it to NULL after freeing it, because in client mode,
the conn may be added to reconnect thread while vsocket is
destroyed. In one case, if qemu create vhostuser port as a
server with the same unix path, the reconnect thread will
reconnect to it while vsocket is destroyed.

To fix this:
1. set vsocket to NULL after free it.
2. remove the reconnection from reconnection thread in suitable
   position.

Cc: stable@dpdk.org
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/socket.c