diff options
-rw-r--r-- | drivers/xen/gntdev.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 2c4cc940c429..2a4733c621c0 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -294,7 +294,9 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages) | |||
294 | if (pgno >= offset && pgno < offset + pages && use_ptemod) { | 294 | if (pgno >= offset && pgno < offset + pages && use_ptemod) { |
295 | void __user *tmp; | 295 | void __user *tmp; |
296 | tmp = map->vma->vm_start + map->notify.addr; | 296 | tmp = map->vma->vm_start + map->notify.addr; |
297 | copy_to_user(tmp, &err, 1); | 297 | err = copy_to_user(tmp, &err, 1); |
298 | if (err) | ||
299 | return err; | ||
298 | map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; | 300 | map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; |
299 | } else if (pgno >= offset && pgno < offset + pages) { | 301 | } else if (pgno >= offset && pgno < offset + pages) { |
300 | uint8_t *tmp = kmap(map->pages[pgno]); | 302 | uint8_t *tmp = kmap(map->pages[pgno]); |
@@ -599,6 +601,12 @@ static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) | |||
599 | goto unlock_out; | 601 | goto unlock_out; |
600 | 602 | ||
601 | found: | 603 | found: |
604 | if ((op.action & UNMAP_NOTIFY_CLEAR_BYTE) && | ||
605 | (map->flags & GNTMAP_readonly)) { | ||
606 | rc = -EINVAL; | ||
607 | goto unlock_out; | ||
608 | } | ||
609 | |||
602 | map->notify.flags = op.action; | 610 | map->notify.flags = op.action; |
603 | map->notify.addr = op.index - (map->index << PAGE_SHIFT); | 611 | map->notify.addr = op.index - (map->index << PAGE_SHIFT); |
604 | map->notify.event = op.event_channel_port; | 612 | map->notify.event = op.event_channel_port; |