From 9d2be9287107695708e6aae5105a8a518a6cb4d0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 8 Sep 2012 12:57:35 +0300 Subject: xen/privcmd: return -EFAULT on error __copy_to_user() returns the number of bytes remaining to be copied but we want to return a negative error code here. Acked-by: Andres Lagar-Cavilla Signed-off-by: Dan Carpenter Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/privcmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/xen/privcmd.c') diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 3b162c65620..ef6389580b8 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -389,8 +389,11 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) state.err = err_array; ret = traverse_pages(m.num, sizeof(xen_pfn_t), &pagelist, mmap_return_errors_v1, &state); - } else if (version == 2) + } else if (version == 2) { ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); + if (ret) + ret = -EFAULT; + } /* If we have not had any EFAULT-like global errors then set the global * error to -ENOENT if necessary. */ -- cgit v1.2.3