mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
nfit: in acpi_nfit_init, break on a 0-length table
If acpi_nfit_init is called (such as from nfit_test), with an nfit table that has more memory allocated than it needs (and a similarly large 'size' field, add_tables would happily keep adding null SPA Range tables filling up all available memory. Make it friendlier by breaking out if a 0-length header is found in any of the tables. Cc: Dan Williams <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Signed-off-by: Vishal Verma <[email protected]> Signed-off-by: Dan Williams <[email protected]>
This commit is contained in:
parent
7379047d55
commit
564d501187
1 changed files with 6 additions and 0 deletions
|
|
@ -335,6 +335,12 @@ static void *add_table(struct acpi_nfit_desc *acpi_desc, void *table,
|
|||
return NULL;
|
||||
|
||||
hdr = table;
|
||||
if (!hdr->length) {
|
||||
dev_warn(dev, "found a zero length table '%d' parsing nfit\n",
|
||||
hdr->type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (hdr->type) {
|
||||
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
|
||||
if (!add_spa(acpi_desc, table))
|
||||
|
|
|
|||
Loading…
Reference in a new issue