vhost: correctly remove wait queue during poll failure
commit4bc596d0b1de9e2c11e4e69c32b41fc807367a60
authorJason Wang <jasowang@redhat.com>
Tue, 27 Mar 2018 12:50:52 +0000 (27 20:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:52:23 +0000 (13 19:52 +0200)
tree2dd9053e5d797eeb4d08a373c20cbfb0179c79ea
parent8403439194395abb0e83a2aface0ae374d6bdf23
vhost: correctly remove wait queue during poll failure

[ Upstream commit dc6455a71c7fc5117977e197f67f71b49f27baba ]

We tried to remove vq poll from wait queue, but do not check whether
or not it was in a list before. This will lead double free. Fixing
this by switching to use vhost_poll_stop() which zeros poll->wqh after
removing poll from waitqueue to make sure it won't be freed twice.

Cc: Darren Kenny <darren.kenny@oracle.com>
Reported-by: syzbot+c0272972b01b872e604a@syzkaller.appspotmail.com
Fixes: 2b8b328b61c79 ("vhost_net: handle polling errors when setting backend")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vhost/vhost.c