]> git.baikalelectronics.ru Git - kernel.git/commit
vhost: Don't call access_ok() when using IOTLB
authorGreg Kurz <groug@kaod.org>
Sat, 3 Oct 2020 10:01:52 +0000 (12:01 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 4 Oct 2020 07:43:03 +0000 (03:43 -0400)
commitee57f97f9034276cd945c7a75c610588feec466e
tree43deeb36d07efb02ea3695934c31c2bf3ebd894d
parent46052f37573ee1388f426086220ad35bfb8dcfdb
vhost: Don't call access_ok() when using IOTLB

When the IOTLB device is enabled, the vring addresses we get
from userspace are GIOVAs. It is thus wrong to pass them down
to access_ok() which only takes HVAs.

Access validation is done at prefetch time with IOTLB. Teach
vq_access_ok() about that by moving the (vq->iotlb) check
from vhost_vq_access_ok() to vq_access_ok(). This prevents
vhost_vring_set_addr() to fail when verifying the accesses.
No behavior change for vhost_vq_access_ok().

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1883084
Fixes: ac35b12314c7 ("vhost: new device IOTLB API")
Cc: jasowang@redhat.com
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: Greg Kurz <groug@kaod.org>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/160171931213.284610.2052489816407219136.stgit@bahia.lan
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vhost.c