From: "Jan Beulich" Subject: Re: [PATCH] ACPI: Prevent acpi_table_entries from falling into a infinite loop Date: Tue, 03 Jun 2014 16:51:46 +0100 Message-ID: <538E0B3202000078000177FA@mail.emea.novell.com> References: <538DE1C1.7090503@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <538DE1C1.7090503@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Malcolm Crossley Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 03.06.14 at 16:54, 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 > > Could you put a reference to the Linux commit in the message? I was about to ask the same. > Reviewed-by: Andrew Cooper > >> >> 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