ACPI fixes for v4.12-rc6
- Revert a 4.11 ACPICA change that made assumptions which are not satisfied on some systems and caused the enumeration of resources to fail on them (Rafael Wysocki). - Add a mechanism to prevent tables from being unmapped prematurely due to reference counter overflows (Lv Zheng). -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJZQdKmAAoJEILEb/54YlRxUi0P/1DTWBBbFuaqQX643ilB+Viq 5DkIaCO7br+xYRqfbSY9cIFfZHBJVIPrBWzuIbEQcdaEhZbZW5gOwu7FyD8n0z3p ydrBR02RYZ0m9n0e9BOiRkvRaI7uUNGvy0rXJsvm19azWRyDxB5KDJHSpSiogywe 6UqXWgJgdTmFs5zYVnsqm47Loed1wGUJJOdr1A9iryVIX+Juc74FQhoATx2GRESi TBigQnYnHDFdOQQyBAntr3ELWFyVJ2B3HtokFgNdsgeOpE7kDiB7kfcE+T/QGLH3 RwSjRglDlnelCDayinoMIblSHP1UI663rGHjTv+m+CDyR3xzHZi3aHJapeifW7x8 7erp4KWzxZqW5OjMkSn4I4s2zZVHlWmEpsGNUL46YPC3neVRPxvNo/26fNNisUdj AGlT5+Hw8fLddlt7CQGzRVbBBINAu3S6wrhfVJ0WGc+kqsAK7QiVnvt7oWYcNZkc FZ0mxISNqqep+TfeqSqDCfd6VZgK0aGcUBzZNuTnWR1Nq9JLAboZh25mI4vpM09/ etaa5b0MRT6IzWowQ4lxRMpBJbSX6vDG0fRdb0FlIHTrAEiSyuwh1uejDRJbnwLy +T/ucHNiY/XBBYXZuSrv6Gu4eKnBKA8bczGFQE6F3PnqMSrQ/N3tqRvEaAeRTddv O3m9tLs1QRC8fvashjCs =Rk+Z -----END PGP SIGNATURE----- Merge tag 'acpi-4.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI fixes from Rafael Wysocki: "These revert an ACPICA commit from the 4.11 cycle that causes problems to happen on some systems and add a protection against possible kernel crashes due to table reference counter imbalance. Specifics: - Revert a 4.11 ACPICA change that made assumptions which are not satisfied on some systems and caused the enumeration of resources to fail on them (Rafael Wysocki). - Add a mechanism to prevent tables from being unmapped prematurely due to reference counter overflows (Lv Zheng)" * tag 'acpi-4.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPICA: Tables: Mechanism to handle late stage acpi_get_table() imbalance Revert "ACPICA: Disassembler: Enhance resource descriptor detection"zero-colors
commit
35e60a6b75
|
@ -416,9 +416,18 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc,
|
|||
}
|
||||
}
|
||||
|
||||
table_desc->validation_count++;
|
||||
if (table_desc->validation_count == 0) {
|
||||
table_desc->validation_count--;
|
||||
if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
|
||||
table_desc->validation_count++;
|
||||
|
||||
/*
|
||||
* Detect validation_count overflows to ensure that the warning
|
||||
* message will only be printed once.
|
||||
*/
|
||||
if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
|
||||
ACPI_WARNING((AE_INFO,
|
||||
"Table %p, Validation count overflows\n",
|
||||
table_desc));
|
||||
}
|
||||
}
|
||||
|
||||
*out_table = table_desc->pointer;
|
||||
|
@ -445,13 +454,20 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc)
|
|||
|
||||
ACPI_FUNCTION_TRACE(acpi_tb_put_table);
|
||||
|
||||
if (table_desc->validation_count == 0) {
|
||||
ACPI_WARNING((AE_INFO,
|
||||
"Table %p, Validation count is zero before decrement\n",
|
||||
table_desc));
|
||||
return_VOID;
|
||||
if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
|
||||
table_desc->validation_count--;
|
||||
|
||||
/*
|
||||
* Detect validation_count underflows to ensure that the warning
|
||||
* message will only be printed once.
|
||||
*/
|
||||
if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
|
||||
ACPI_WARNING((AE_INFO,
|
||||
"Table %p, Validation count underflows\n",
|
||||
table_desc));
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
table_desc->validation_count--;
|
||||
|
||||
if (table_desc->validation_count == 0) {
|
||||
|
||||
|
|
|
@ -474,15 +474,6 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
|
|||
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
|
||||
}
|
||||
|
||||
/*
|
||||
* The end_tag opcode must be followed by a zero byte.
|
||||
* Although this byte is technically defined to be a checksum,
|
||||
* in practice, all ASL compilers set this byte to zero.
|
||||
*/
|
||||
if (*(aml + 1) != 0) {
|
||||
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
|
||||
}
|
||||
|
||||
/* Return the pointer to the end_tag if requested */
|
||||
|
||||
if (!user_function) {
|
||||
|
|
|
@ -374,6 +374,20 @@ struct acpi_table_desc {
|
|||
u16 validation_count;
|
||||
};
|
||||
|
||||
/*
|
||||
* Maximum value of the validation_count field in struct acpi_table_desc.
|
||||
* When reached, validation_count cannot be changed any more and the table will
|
||||
* be permanently regarded as validated.
|
||||
*
|
||||
* This is to prevent situations in which unbalanced table get/put operations
|
||||
* may cause premature table unmapping in the OS to happen.
|
||||
*
|
||||
* The maximum validation count can be defined to any value, but should be
|
||||
* greater than the maximum number of OS early stage mapping slots to avoid
|
||||
* leaking early stage table mappings to the late stage.
|
||||
*/
|
||||
#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX
|
||||
|
||||
/* Masks for Flags field above */
|
||||
|
||||
#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */
|
||||
|
|
Loading…
Reference in New Issue