aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/evgpeutil.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2015-02-05 02:20:29 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-02-05 09:31:38 -0500
commit7c43312af8b363b679d1e7840858ff8d204a4d91 (patch)
treecf76717eb2a03d23f6f1dccd0cb416929624c4f7 /drivers/acpi/acpica/evgpeutil.c
parent779ba5a39214f0e3112bd2b94c26df03dc518a29 (diff)
ACPICA: Events: Cleanup GPE dispatcher type obtaining code
ACPICA commit 7926d5ca9452c87f866938dcea8f12e1efb58f89 There is an issue in acpi_install_gpe_handler() and acpi_remove_gpe_handler(). The code to obtain the GPE dispatcher type from the Handler->original_flags is wrong: if (((Handler->original_flags & ACPI_GPE_DISPATCH_METHOD) || (Handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) && ACPI_GPE_DISPATCH_NOTIFY is 0x03 and ACPI_GPE_DISPATCH_METHOD is 0x02, thus this statement is TRUE for the following dispatcher types: 0x01 (ACPI_GPE_DISPATCH_HANDLER): not expected 0x02 (ACPI_GPE_DISPATCH_METHOD): expected 0x03 (ACPI_GPE_DISPATCH_NOTIFY): expected There is no functional issue due to this because Handler->original_flags is only set in acpi_install_gpe_handler(), and an earlier checker has excluded the ACPI_GPE_DISPATCH_HANDLER: if ((gpe_event_info->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { Status = AE_ALREADY_EXISTS; goto free_and_exit; } ... Handler->original_flags = (u8) (gpe_event_info->Flags & (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK)); We need to clean this up before modifying the GPE dispatcher type values. In order to prevent such issue from happening in the future, this patch introduces ACPI_GPE_DISPATCH_TYPE() macro to be used to obtain the GPE dispatcher types. Lv Zheng. Link: https://github.com/acpica/acpica/commit/7926d5ca Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/evgpeutil.c')
-rw-r--r--drivers/acpi/acpica/evgpeutil.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 3f1c5aa682a5..b1978122f6a9 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -324,7 +324,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
324 ACPI_GPE_REGISTER_WIDTH) 324 ACPI_GPE_REGISTER_WIDTH)
325 + j]; 325 + j];
326 326
327 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 327 if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
328 ACPI_GPE_DISPATCH_HANDLER) { 328 ACPI_GPE_DISPATCH_HANDLER) {
329 329
330 /* Delete an installed handler block */ 330 /* Delete an installed handler block */
@@ -333,10 +333,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
333 gpe_event_info->dispatch.handler = NULL; 333 gpe_event_info->dispatch.handler = NULL;
334 gpe_event_info->flags &= 334 gpe_event_info->flags &=
335 ~ACPI_GPE_DISPATCH_MASK; 335 ~ACPI_GPE_DISPATCH_MASK;
336 } else 336 } else if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)
337 if ((gpe_event_info-> 337 == ACPI_GPE_DISPATCH_NOTIFY) {
338 flags & ACPI_GPE_DISPATCH_MASK) ==
339 ACPI_GPE_DISPATCH_NOTIFY) {
340 338
341 /* Delete the implicit notification device list */ 339 /* Delete the implicit notification device list */
342 340