Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525050

[PATCH 2/2] vhost: forbid IOTLB invalidation when not enabled

From Jason Wang <jasowang@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] vhost: forbid IOTLB invalidation when not enabled
Date 2016-11-18 09:00 +0100
Message-ID <sEMfv-49Z-5@gated-at.bofh.it> (permalink)
References <sEMfv-49Z-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When IOTLB is not enabled, we should forbid IOTLB invalidation to
avoid a NULL pointer dereference.

Signed-off-by: Jason Wang <jasowang@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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 2/2] vhost: forbid IOTLB invalidation when not enabled Jason Wang <jasowang@redhat.com> - 2016-11-18 09:00 +0100

csiph-web