* [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop
@ 2014-06-03 14:51 Malcolm Crossley
2014-06-03 14:54 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Malcolm Crossley @ 2014-06-03 14:51 UTC (permalink / raw)
To: xen-devel; +Cc: JBeulich
If a buggy BIOS programs an ACPI table with entry length 0 then
acpi_table_entries gets stuck in an infinite loop.
To aid debugging, report the error and exit the loop.
Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
diff -r 4708591d8aa8 -r af3b2493951c xen/drivers/acpi/tables.c
--- a/xen/drivers/acpi/tables.c
+++ b/xen/drivers/acpi/tables.c
@@ -238,6 +238,12 @@ acpi_table_parse_entries(char *id,
if (handler(entry, table_end))
return -EINVAL;
+ if (entry->length == 0) {
+ printk(KERN_ERR PREFIX "[%4.4s:0x%02x] Invalid zero length\n",
+ id, entry_id);
+ return -EINVAL;
+ }
+
entry = (struct acpi_subtable_header *)
((unsigned long)entry + entry->length);
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop
2014-06-03 14:51 [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop Malcolm Crossley
@ 2014-06-03 14:54 ` Andrew Cooper
2014-06-03 15:51 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2014-06-03 14:54 UTC (permalink / raw)
To: Malcolm Crossley; +Cc: JBeulich, xen-devel
On 03/06/14 15:51, Malcolm Crossley wrote:
> If a buggy BIOS programs an ACPI table with entry length 0 then
> acpi_table_entries gets stuck in an infinite loop.
>
> To aid debugging, report the error and exit the loop.
>
> Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Could you put a reference to the Linux commit in the message?
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> diff -r 4708591d8aa8 -r af3b2493951c xen/drivers/acpi/tables.c
> --- a/xen/drivers/acpi/tables.c
> +++ b/xen/drivers/acpi/tables.c
> @@ -238,6 +238,12 @@ acpi_table_parse_entries(char *id,
> if (handler(entry, table_end))
> return -EINVAL;
>
> + if (entry->length == 0) {
> + printk(KERN_ERR PREFIX "[%4.4s:0x%02x] Invalid zero length\n",
> + id, entry_id);
> + return -EINVAL;
> + }
> +
> entry = (struct acpi_subtable_header *)
> ((unsigned long)entry + entry->length);
> }
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop
2014-06-03 14:54 ` Andrew Cooper
@ 2014-06-03 15:51 ` Jan Beulich
0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2014-06-03 15:51 UTC (permalink / raw)
To: Andrew Cooper, Malcolm Crossley; +Cc: xen-devel
>>> On 03.06.14 at 16:54, <andrew.cooper3@citrix.com> wrote:
> On 03/06/14 15:51, Malcolm Crossley wrote:
>> If a buggy BIOS programs an ACPI table with entry length 0 then
>> acpi_table_entries gets stuck in an infinite loop.
>>
>> To aid debugging, report the error and exit the loop.
>>
>> Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
>
> Could you put a reference to the Linux commit in the message?
I was about to ask the same.
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
>>
>> diff -r 4708591d8aa8 -r af3b2493951c xen/drivers/acpi/tables.c
>> --- a/xen/drivers/acpi/tables.c
>> +++ b/xen/drivers/acpi/tables.c
>> @@ -238,6 +238,12 @@ acpi_table_parse_entries(char *id,
>> if (handler(entry, table_end))
>> return -EINVAL;
>>
>> + if (entry->length == 0) {
Furthermore I think this should be done more robustly by
checking <= sizeof(*entry), and before actually doing anything
else with it.
Jan
>> + printk(KERN_ERR PREFIX "[%4.4s:0x%02x] Invalid zero length\n",
>> + id, entry_id);
>> + return -EINVAL;
>> + }
>> +
>> entry = (struct acpi_subtable_header *)
>> ((unsigned long)entry + entry->length);
>> }
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-03 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 14:51 [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop Malcolm Crossley
2014-06-03 14:54 ` Andrew Cooper
2014-06-03 15:51 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.