vhost-vdpa: protect concurrent access to vhost device iotlb
authorXie Yongji <xieyongji@bytedance.com>
Mon, 12 Apr 2021 09:55:12 +0000 (17:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Apr 2021 11:39:59 +0000 (13:39 +0200)
commit71777492b745837481630c751111eeb19bb589cf
tree262ba7b0a1d4b93fe050b597b9bb873b7a0b2636
parentaea70bd5a45591de27aac367af94d184892c06ab
vhost-vdpa: protect concurrent access to vhost device iotlb

commit a9d064524fc3cf463b3bb14fa63de78aafb40dab upstream.

Protect vhost device iotlb by vhost_dev->mutex. Otherwise,
it might cause corruption of the list and interval tree in
struct vhost_iotlb if userspace sends the VHOST_IOTLB_MSG_V2
message concurrently.

Fixes: 4c8cf318("vhost: introduce vDPA-based backend")
Cc: stable@vger.kernel.org
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20210412095512.178-1-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vhost/vdpa.c