Commit 6f3180af authored by Jason Wang's avatar Jason Wang Committed by David S. Miller
Browse files

vhost: do not try to access device IOTLB when not initialized

The code will try to access dev->iotlb when processing
VHOST_IOTLB_INVALIDATE even if it was not initialized which may lead
to NULL pointer dereference. Fixes this by check dev->iotlb before.

Fixes: 6b1e6cc7

 ("vhost: new device IOTLB API")
Signed-off-by: default avatarJason Wang <>
Acked-by: default avatarMichael S. Tsirkin <>
Signed-off-by: default avatarDavid S. Miller <>
parent e9cb4239
......@@ -1015,6 +1015,10 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev,
vhost_iotlb_notify_vq(dev, msg);
if (!dev->iotlb) {
ret = -EFAULT;
vhost_del_umem_range(dev->iotlb, msg->iova,
msg->iova + msg->size - 1);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment