From patchwork Wed Dec 15 00:55:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 412031 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBF0owGg012349 for ; Wed, 15 Dec 2010 00:50:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760269Ab0LOAuu (ORCPT ); Tue, 14 Dec 2010 19:50:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:25467 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760251Ab0LOAuu (ORCPT ); Tue, 14 Dec 2010 19:50:50 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Dec 2010 16:50:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,345,1288594800"; d="scan'208";a="636386960" Received: from minggr.sh.intel.com (HELO [10.239.13.26]) ([10.239.13.26]) by fmsmga002.fm.intel.com with ESMTP; 14 Dec 2010 16:50:48 -0800 Subject: [PATCH] ACPICA: Fix namespace race condition From: Lin Ming To: lenb , Dana Myers , Bob Moore Cc: linux-acpi Date: Wed, 15 Dec 2010 08:55:41 +0800 Message-ID: <1292374541.10384.158.camel@minggr.sh.intel.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Dec 2010 00:50:58 +0000 (UTC) diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 1e5ff80..222a23e 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c @@ -341,6 +341,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) { struct acpi_namespace_node *child_node = NULL; u32 level = 1; + acpi_status status; ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); @@ -348,6 +349,13 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) return_VOID; } + /* Lock namespace for possible update */ + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_VOID; + } + /* * Traverse the tree of objects until we bubble back up * to where we started. @@ -397,6 +405,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) } } + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_VOID; }