[1/6] vhost: don't set uaddr for invalid address
diff mbox series

Message ID 20190723075718.6275-2-jasowang@redhat.com
State New, archived
Headers show
  • Fixes for meta data acceleration
Related show

Commit Message

Jason Wang July 23, 2019, 7:57 a.m. UTC
We should not setup uaddr for the invalid address, otherwise we may
try to pin or prefetch mapping of wrong pages.

Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address")
Signed-off-by: Jason Wang <jasowang@redhat.com>
 drivers/vhost/vhost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index dc9301d31f12..34c0d970bcbc 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -2083,7 +2083,8 @@  static long vhost_vring_set_num_addr(struct vhost_dev *d,
-	vhost_setup_vq_uaddr(vq);
+	if (r == 0)
+		vhost_setup_vq_uaddr(vq);
 	if (d->mm)
 		mmu_notifier_register(&d->mmu_notifier, d->mm);