Signed-off-by: Jason Wang <jasowang at redhat.com> --- include/uapi/linux/vhost.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index 56b7ab5..60180c0 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -172,8 +172,6 @@ struct vhost_memory { #define VHOST_F_LOG_ALL 26 /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ #define VHOST_NET_F_VIRTIO_NET_HDR 27 -/* Vhost have device IOTLB */ -#define VHOST_F_DEVICE_IOTLB 63 /* VHOST_SCSI specific definitions */ -- 2.7.4
Jason Wang
2016-Nov-18 07:58 UTC
[PATCH 2/2] vhost: forbid IOTLB invalidation when not enabled
When IOTLB is not enabled, we should forbid IOTLB invalidation to avoid a NULL pointer dereference. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/vhost.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c6f2d89..7d338d5 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -959,6 +959,10 @@ int vhost_process_iotlb_msg(struct vhost_dev *dev, vhost_iotlb_notify_vq(dev, msg); break; case VHOST_IOTLB_INVALIDATE: + if (!dev->iotlb) { + ret = -EFAULT; + break; + } vhost_del_umem_range(dev->iotlb, msg->iova, msg->iova + msg->size - 1); break; -- 2.7.4
Apparently Analagous Threads
- [PATCH 1/2] vhost: remove unused feature bit
- [PATCH net 1/2] vhost: use mutex_lock_nested() in vhost_dev_lock_vqs()
- [PATCH net 1/2] vhost: use mutex_lock_nested() in vhost_dev_lock_vqs()
- [PATCH V2 0/3] basic device IOTLB support for vhost_net
- [PATCH V2 0/3] basic device IOTLB support for vhost_net