* [PATCH] ACPI: fix return value of XEN_PM_PDC platform op
@ 2012-11-28 7:44 Jan Beulich
2012-11-28 8:28 ` Keir Fraser
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-11-28 7:44 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
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>
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
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;
}
[-- Attachment #2: ACPI-set-PDC-bits-rc.patch --]
[-- Type: text/plain, Size: 766 bytes --]
ACPI: fix return value of XEN_PM_PDC platform op
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>
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
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;
}
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI: fix return value of XEN_PM_PDC platform op
2012-11-28 7:44 [PATCH] ACPI: fix return value of XEN_PM_PDC platform op Jan Beulich
@ 2012-11-28 8:28 ` Keir Fraser
0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-11-28 8:28 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 28/11/2012 07:44, "Jan Beulich" <JBeulich@suse.com> wrote:
> 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>
> --- a/xen/drivers/acpi/pmstat.c
> +++ b/xen/drivers/acpi/pmstat.c
> @@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
> 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;
> }
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-28 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 7:44 [PATCH] ACPI: fix return value of XEN_PM_PDC platform op Jan Beulich
2012-11-28 8:28 ` Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).