mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Steven Clarkson <sc@lambdal.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/boot: Handle malformed SRAT tables during early ACPI parsing
Date: Fri, 31 Jan 2020 19:55:31 +0100	[thread overview]
Message-ID: <20200131185531.GC14851@zn.tnic> (raw)
In-Reply-To: <CAHKq8taGzj0u1E_i=poHUam60Bko5BpiJ9jn0fAupFUYexvdUQ@mail.gmail.com>

On Thu, Jan 30, 2020 at 04:48:16PM -0800, Steven Clarkson wrote:
> Break an infinite loop when early parsing SRAT caused by a subtable with
> zero length. Known to affect the ASUS WS X299 SAGE motherboard with
> firmware version 1201, which has a large block of zeros in its SRAT table.
> The kernel could boot successfully on this board/firmware prior to the
> introduction of early parsing this table.
> 
> Fixes: 02a3e3cdb7f1 ("x86/boot: Parse SRAT table and count immovable
> memory regions")
> Signed-off-by: Steven Clarkson <sc@lambdal.com>
> ---
>  arch/x86/boot/compressed/acpi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
> index 25019d42ae93..1a4479c5edfc 100644
> --- a/arch/x86/boot/compressed/acpi.c
> +++ b/arch/x86/boot/compressed/acpi.c
> @@ -394,6 +394,12 @@ int count_immovable_mem_regions(void)
> 
>         while (table + sizeof(struct acpi_subtable_header) < table_end) {
>                 sub_table = (struct acpi_subtable_header *)table;
> +
> +               if (!sub_table->length) {
> +                       debug_putstr("Invalid zero length SRAT subtable.\n");
> +                       break;
> +               }
> +
>                 if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) {
>                         struct acpi_srat_mem_affinity *ma;
> 
> -- 

Only in case you want to send patches in the future, see below.
scripts/checkpatch.pl can do that checking for you before you send. I'll
fix it up now.

ERROR: code indent should use tabs where possible
#37: FILE: arch/x86/boot/compressed/acpi.c:398:
+               if (!sub_table->length) {$

WARNING: please, no spaces at the start of a line
#37: FILE: arch/x86/boot/compressed/acpi.c:398:
+               if (!sub_table->length) {$

WARNING: suspect code indent for conditional statements (15, 23)
#37: FILE: arch/x86/boot/compressed/acpi.c:398:
+               if (!sub_table->length) {
+                       debug_putstr("Invalid zero length SRAT subtable.\n");

ERROR: code indent should use tabs where possible
#38: FILE: arch/x86/boot/compressed/acpi.c:399:
+                       debug_putstr("Invalid zero length SRAT subtable.\n");$

WARNING: please, no spaces at the start of a line
#38: FILE: arch/x86/boot/compressed/acpi.c:399:
+                       debug_putstr("Invalid zero length SRAT subtable.\n");$

ERROR: code indent should use tabs where possible
#39: FILE: arch/x86/boot/compressed/acpi.c:400:
+                       break;$

WARNING: please, no spaces at the start of a line
#39: FILE: arch/x86/boot/compressed/acpi.c:400:
+                       break;$

ERROR: code indent should use tabs where possible
#40: FILE: arch/x86/boot/compressed/acpi.c:401:
+               }$

WARNING: please, no spaces at the start of a line
#40: FILE: arch/x86/boot/compressed/acpi.c:401:
+               }$

total: 4 errors, 5 warnings, 12 lines checked


-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

  reply	other threads:[~2020-01-31 18:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  0:48 Steven Clarkson
2020-01-31 18:55 ` Borislav Petkov [this message]
2020-01-31 23:00   ` Steven Clarkson
2020-01-31 23:02     ` Borislav Petkov
2020-01-31 18:58 ` [tip: x86/urgent] " tip-bot2 for Steven Clarkson
2020-01-31 19:10 ` tip-bot2 for Steven Clarkson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200131185531.GC14851@zn.tnic \
    --to=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sc@lambdal.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®