Skip to contentSkip to conversation

vhost: remove unused feature bit

PATCH New Jason Wang 1 participant 2 messages Nov 18, 2016

Subsystems (5)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/2 vhost: remove unused feature bit

---
 include/uapi/linux/vhost.h | 2 --
 1 file changed, 2 deletions(-)
include/uapi/linux/vhost.h +0 -2
index 56b7ab5..60180c0 100644
@@ -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 */
 
Signature · 1 line
2.7.4
author
#1 lore raw

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.

---
 drivers/vhost/vhost.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/vhost/vhost.c +4 -0
index c6f2d89..7d338d5 100644
@@ -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;
Signature · 1 line
2.7.4