vhost: fix race condition when adding fd in the fdset
authorMatthias Gatto <matthias.gatto@outscale.com>
Thu, 6 Dec 2018 16:00:07 +0000 (16:00 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:40 +0000 (16:22 +0100)
commit276d63505be94bb8d5fdf754af0105707ea433c1
tree825d4e835aebe57f8641903748e37734d755c0aa
parent6ef75e405d5a88e8806b261c1a6c3f6b30385007
vhost: fix race condition when adding fd in the fdset

fdset_add can call fdset_shrink_nolock which call fdset_move
concurrently to poll that is call in fdset_event_dispatch.

This patch add a mutex to protect poll from been call at the same time
fdset_add call fdset_shrink_nolock.

Fixes: 1b815b89599c ("vhost: try to shrink pfdset when fdset_add fails")
Cc: stable@dpdk.org
Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/fd_man.c
lib/librte_vhost/fd_man.h
lib/librte_vhost/socket.c