Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9186fb58 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: Improve parameter validation for acpi_install_gpe_block.



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: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d72c17a8
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -583,6 +583,18 @@ acpi_install_gpe_block(acpi_handle gpe_device,
		goto unlock_and_exit;
		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
	 * For user-installed GPE Block Devices, the gpe_block_base_number
	 * is always zero
	 * is always zero
@@ -666,6 +678,13 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
		goto unlock_and_exit;
		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 */
	/* Get the device_object attached to the node */


	obj_desc = acpi_ns_get_attached_object(node);
	obj_desc = acpi_ns_get_attached_object(node);