Skip to content

Commit

Permalink
xen/gntdev: Fix off-by-one error when unmapping with holes
Browse files Browse the repository at this point in the history
If the requested range has a hole, the calculation of the number of
pages to unmap is off by one. Fix it.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
  • Loading branch information
Ross Lagerwall authored and Boris Ostrovsky committed Jan 10, 2018
1 parent 66a640e commit 951a010
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/xen/gntdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ static int unmap_grant_pages(struct grant_map *map, int offset, int pages)
}
range = 0;
while (range < pages) {
if (map->unmap_ops[offset+range].handle == -1) {
range--;
if (map->unmap_ops[offset+range].handle == -1)
break;
}
range++;
}
err = __unmap_grant_pages(map, offset, range);
Expand Down

0 comments on commit 951a010

Please sign in to comment.