projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
816e85e
)
vhost: fix end of range for access_ok
author
Michael S. Tsirkin
<
[email protected]
>
Mon, 21 Aug 2017 19:33:33 +0000
(22:33 +0300)
committer
Michael S. Tsirkin
<
[email protected]
>
Tue, 14 Nov 2017 21:57:39 +0000
(23:57 +0200)
During access_ok checks, addr increases as we iterate over the data
structure, thus addr + len - 1 will point beyond the end of region we
are translating. Harmless since we then verify that the region covers
addr, but let's not waste cpu cycles.
Reported-by: Koichiro Den <
[email protected]
>
Signed-off-by: Michael S. Tsirkin <
[email protected]
>
Acked-by: Koichiro Den <
[email protected]
>
drivers/vhost/vhost.c
patch
|
blob
|
history
diff --git
a/drivers/vhost/vhost.c
b/drivers/vhost/vhost.c
index d6dbb28245e6d28129e6c7d18b52589d6ba2a2bb..33ac2b186b85eb1f4883d26d6d0d9b3a8532fc01 100644
(file)
--- a/
drivers/vhost/vhost.c
+++ b/
drivers/vhost/vhost.c
@@
-1175,7
+1175,7
@@
static int iotlb_access_ok(struct vhost_virtqueue *vq,
{
const struct vhost_umem_node *node;
struct vhost_umem *umem = vq->iotlb;
- u64 s = 0, size, orig_addr = addr;
+ u64 s = 0, size, orig_addr = addr
, last = addr + len - 1
;
if (vhost_vq_meta_fetch(vq, addr, len, type))
return true;
@@
-1183,7
+1183,7
@@
static int iotlb_access_ok(struct vhost_virtqueue *vq,
while (len > s) {
node = vhost_umem_interval_tree_iter_first(&umem->umem_tree,
addr,
-
addr + len - 1
);
+
last
);
if (node == NULL || node->start > addr) {
vhost_iotlb_miss(vq, addr, access);
return false;