ACPI: fix return value of XEN_PM_PDC platform op
authorJan Beulich <jbeulich@suse.com>
Wed, 28 Nov 2012 09:03:51 +0000 (10:03 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 28 Nov 2012 09:03:51 +0000 (10:03 +0100)
Should return -EFAULT when copying to guest memory fails.

Once touching this code, also switch to using the more relaxed copy
function (copying from the same guest memory already validated the
virtual address range).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/drivers/acpi/pmstat.c

index bf30cc729ae3122b05cb529d7e1749ab67d0d064..f8a9c85eb993e0ada0f7c2ebb379d1f5b7bcdc1e 100644 (file)
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE_PARAM(uint32) pdc)
                     ACPI_PDC_SMP_C1PT) & ~mask;
         ret = arch_acpi_set_pdc_bits(acpi_id, bits, mask);
     }
-    if ( !ret )
-        ret = copy_to_guest_offset(pdc, 2, bits + 2, 1);
+    if ( !ret && __copy_to_guest_offset(pdc, 2, bits + 2, 1) )
+        ret = -EFAULT;
 
     return ret;
 }