0078-ACPI-APEI-remove-the-unused-dead-code-for-SEA-NMI-no.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From 8edefc098e2ff088d8c22d034bf8a5adf76b7295 Mon Sep 17 00:00:00 2001
  2. From: Dongjiu Geng <[email protected]>
  3. Date: Tue, 17 Oct 2017 16:02:20 +0800
  4. Subject: [PATCH 078/242] ACPI / APEI: remove the unused dead-code for SEA/NMI
  5. notification type
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. For the SEA notification, the two functions ghes_sea_add() and
  11. ghes_sea_remove() are only called when CONFIG_ACPI_APEI_SEA
  12. is defined. If not, it will return errors in the ghes_probe()
  13. and not continue. If the probe is failed, the ghes_sea_remove()
  14. also has no chance to be called. Hence, remove the unnecessary
  15. handling when CONFIG_ACPI_APEI_SEA is not defined.
  16. For the NMI notification, it has the same issue as SEA notification,
  17. so also remove the unused dead-code for it.
  18. Signed-off-by: Dongjiu Geng <[email protected]>
  19. Tested-by: Tyler Baicar <[email protected]>
  20. Reviewed-by: Borislav Petkov <[email protected]>
  21. Signed-off-by: Rafael J. Wysocki <[email protected]>
  22. (cherry picked from commit c49870e89f4d2c21c76ebe90568246bb0f3572b7)
  23. Signed-off-by: Andy Whitcroft <[email protected]>
  24. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  25. (cherry picked from commit 55f73c32ba6438e8886f348722d2b25aef129d40)
  26. Signed-off-by: Fabian Grünbichler <[email protected]>
  27. ---
  28. drivers/acpi/apei/ghes.c | 33 +++++----------------------------
  29. 1 file changed, 5 insertions(+), 28 deletions(-)
  30. diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
  31. index 3628078ee351..4827176f838d 100644
  32. --- a/drivers/acpi/apei/ghes.c
  33. +++ b/drivers/acpi/apei/ghes.c
  34. @@ -850,17 +850,8 @@ static void ghes_sea_remove(struct ghes *ghes)
  35. synchronize_rcu();
  36. }
  37. #else /* CONFIG_ACPI_APEI_SEA */
  38. -static inline void ghes_sea_add(struct ghes *ghes)
  39. -{
  40. - pr_err(GHES_PFX "ID: %d, trying to add SEA notification which is not supported\n",
  41. - ghes->generic->header.source_id);
  42. -}
  43. -
  44. -static inline void ghes_sea_remove(struct ghes *ghes)
  45. -{
  46. - pr_err(GHES_PFX "ID: %d, trying to remove SEA notification which is not supported\n",
  47. - ghes->generic->header.source_id);
  48. -}
  49. +static inline void ghes_sea_add(struct ghes *ghes) { }
  50. +static inline void ghes_sea_remove(struct ghes *ghes) { }
  51. #endif /* CONFIG_ACPI_APEI_SEA */
  52. #ifdef CONFIG_HAVE_ACPI_APEI_NMI
  53. @@ -1062,23 +1053,9 @@ static void ghes_nmi_init_cxt(void)
  54. init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
  55. }
  56. #else /* CONFIG_HAVE_ACPI_APEI_NMI */
  57. -static inline void ghes_nmi_add(struct ghes *ghes)
  58. -{
  59. - pr_err(GHES_PFX "ID: %d, trying to add NMI notification which is not supported!\n",
  60. - ghes->generic->header.source_id);
  61. - BUG();
  62. -}
  63. -
  64. -static inline void ghes_nmi_remove(struct ghes *ghes)
  65. -{
  66. - pr_err(GHES_PFX "ID: %d, trying to remove NMI notification which is not supported!\n",
  67. - ghes->generic->header.source_id);
  68. - BUG();
  69. -}
  70. -
  71. -static inline void ghes_nmi_init_cxt(void)
  72. -{
  73. -}
  74. +static inline void ghes_nmi_add(struct ghes *ghes) { }
  75. +static inline void ghes_nmi_remove(struct ghes *ghes) { }
  76. +static inline void ghes_nmi_init_cxt(void) { }
  77. #endif /* CONFIG_HAVE_ACPI_APEI_NMI */
  78. static int ghes_probe(struct platform_device *ghes_dev)
  79. --
  80. 2.14.2