diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-20 23:52:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-20 23:52:01 -0500 |
commit | 74dcc3f9044320a0580673827a446c9e5593dfc7 (patch) | |
tree | f73d30f96cbd7e8167aa9ddd348c6c3b9f49d756 /drivers/xen | |
parent | 87885b700b9b697ce8601d415cb905862750c3b9 (diff) | |
parent | 68fa965dd923177eafad49b7a0045fc610917341 (diff) |
Merge tag 'stable/for-linus-3.7-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen bug-fix from Konrad Rzeszutek Wilk:
- Fix regression introduced by commit ceb90fa0a800 ("xen/privcmd: add
PRIVCMD_MMAPBATCH_V2 ioctl").
* tag 'stable/for-linus-3.7-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
xen/privcmd: Correctly return success from IOCTL_PRIVCMD_MMAPBATCH
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/privcmd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 8adb9cc267f9..71f5c459b088 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c | |||
@@ -361,13 +361,13 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) | |||
361 | down_write(&mm->mmap_sem); | 361 | down_write(&mm->mmap_sem); |
362 | 362 | ||
363 | vma = find_vma(mm, m.addr); | 363 | vma = find_vma(mm, m.addr); |
364 | ret = -EINVAL; | ||
365 | if (!vma || | 364 | if (!vma || |
366 | vma->vm_ops != &privcmd_vm_ops || | 365 | vma->vm_ops != &privcmd_vm_ops || |
367 | (m.addr != vma->vm_start) || | 366 | (m.addr != vma->vm_start) || |
368 | ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || | 367 | ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || |
369 | !privcmd_enforce_singleshot_mapping(vma)) { | 368 | !privcmd_enforce_singleshot_mapping(vma)) { |
370 | up_write(&mm->mmap_sem); | 369 | up_write(&mm->mmap_sem); |
370 | ret = -EINVAL; | ||
371 | goto out; | 371 | goto out; |
372 | } | 372 | } |
373 | 373 | ||
@@ -383,12 +383,16 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) | |||
383 | 383 | ||
384 | up_write(&mm->mmap_sem); | 384 | up_write(&mm->mmap_sem); |
385 | 385 | ||
386 | if (state.global_error && (version == 1)) { | 386 | if (version == 1) { |
387 | /* Write back errors in second pass. */ | 387 | if (state.global_error) { |
388 | state.user_mfn = (xen_pfn_t *)m.arr; | 388 | /* Write back errors in second pass. */ |
389 | state.err = err_array; | 389 | state.user_mfn = (xen_pfn_t *)m.arr; |
390 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), | 390 | state.err = err_array; |
391 | &pagelist, mmap_return_errors_v1, &state); | 391 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), |
392 | &pagelist, mmap_return_errors_v1, &state); | ||
393 | } else | ||
394 | ret = 0; | ||
395 | |||
392 | } else if (version == 2) { | 396 | } else if (version == 2) { |
393 | ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); | 397 | ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); |
394 | if (ret) | 398 | if (ret) |