ACPICA: Improve parameter validation for acpi_install_gpe_block.
authorBob Moore <robert.moore@intel.com>
Sat, 8 Feb 2014 01:42:19 +0000 (09:42 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 10 Feb 2014 23:30:24 +0000 (00:30 +0100)
Add the following checks:
1) The incoming device handle refers to type ACPI_TYPE_DEVICE.
2) There is not already a gpe block attached to the device.

Likewise, with acpi_remove_gpe_block, ensure that the incoming object
is a device.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/evxfgpe.c

index 5713da77c665b01a5e9dcdbd91abc70a11f4228a..b84f8e25717aa742609e23c02233f70fc67454d4 100644 (file)
@@ -583,6 +583,18 @@ acpi_install_gpe_block(acpi_handle gpe_device,
                goto unlock_and_exit;
        }
 
+       /* Validate the parent device */
+
+       if (node->type != ACPI_TYPE_DEVICE) {
+               status = AE_TYPE;
+               goto unlock_and_exit;
+       }
+
+       if (node->object) {
+               status = AE_ALREADY_EXISTS;
+               goto unlock_and_exit;
+       }
+
        /*
         * For user-installed GPE Block Devices, the gpe_block_base_number
         * is always zero
@@ -666,6 +678,13 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
                goto unlock_and_exit;
        }
 
+       /* Validate the parent device */
+
+       if (node->type != ACPI_TYPE_DEVICE) {
+               status = AE_TYPE;
+               goto unlock_and_exit;
+       }
+
        /* Get the device_object attached to the node */
 
        obj_desc = acpi_ns_get_attached_object(node);
This page took 0.027631 seconds and 5 git commands to generate.