From e128209452d44479ad5cebf0804936ab76f32f72 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 2 Feb 2007 19:48:22 +0300 Subject: [PATCH] --- yaml --- r: 46393 b: refs/heads/master c: f1c2b1daf040d2feebfbbd4a0cd80cde856fc031 h: refs/heads/master i: 46391: e7f1bc41131dcaea0c7bad9a740723b584a95ec0 v: v3 --- [refs] | 2 +- trunk/drivers/acpi/namespace/nsxfname.c | 45 +++++++++++++------------ 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index bae10c2842f1..da025f870f53 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c1014629c0fc563be65e675e72bcc9bd7db50195 +refs/heads/master: f1c2b1daf040d2feebfbbd4a0cd80cde856fc031 diff --git a/trunk/drivers/acpi/namespace/nsxfname.c b/trunk/drivers/acpi/namespace/nsxfname.c index 978213a6c19f..408bd1145728 100644 --- a/trunk/drivers/acpi/namespace/nsxfname.c +++ b/trunk/drivers/acpi/namespace/nsxfname.c @@ -84,38 +84,41 @@ acpi_get_handle(acpi_handle parent, /* Convert a parent handle to a prefix node */ if (parent) { - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return (status); - } - prefix_node = acpi_ns_map_handle_to_node(parent); if (!prefix_node) { - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } + } + + /* + * Valid cases are: + * 1) Fully qualified pathname + * 2) Parent + Relative pathname + * + * Error for + */ + if (acpi_ns_valid_root_prefix(pathname[0])) { - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return (status); + /* Pathname is fully qualified (starts with '\') */ + + /* Special case for root-only, since we can't search for it */ + + if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { + *ret_handle = + acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); + return (AE_OK); } - } + } else if (!prefix_node) { - /* Special case for root, since we can't search for it */ + /* Relative path with null prefix is disallowed */ - if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) { - *ret_handle = - acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); - return (AE_OK); + return (AE_BAD_PARAMETER); } - /* - * Find the Node and convert to a handle - */ - status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, - &node); + /* Find the Node and convert to a handle */ - *ret_handle = NULL; + status = + acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_SUCCESS(status)) { *ret_handle = acpi_ns_convert_entry_to_handle(node); }