linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org
Cc: Rakib Mullick <rakib.mullick@gmail.com>, Len Brown <len.brown@intel.com>
Subject: [PATCH 04/14] ACPI: Fix possible recursive locking in hwregs.c
Date: Sun, 06 Nov 2011 23:11:54 -0500	[thread overview]
Message-ID: <f7f71cfbf0c276ee3d8d856d0f35a41aed997fa4.1320636776.git.len.brown@intel.com> (raw)
In-Reply-To: <1320639124-16178-1-git-send-email-lenb@kernel.org>
In-Reply-To: <aeae1e92daec5a38b40ad12598b97501b675a381.1320636776.git.len.brown@intel.com>

From: Rakib Mullick <rakib.mullick@gmail.com>

Calling pm-suspend might trigger a recursive lock in it's code path.
In function acpi_hw_clear_acpi_status, acpi_os_acquire_lock holds
the lock acpi_gbl_hardware_lock before calling acpi_hw_register_write(),
then without releasing acpi_gbl_hardware_lock, this function calls
acpi_ev_walk_gpe_list, which tries to hold acpi_gbl_gpe_lock.
Both acpi_gbl_hardware_lock and acpi_gbl_gpe_lock are at same
lock-class and which might cause lock recursion deadlock.

Following patch fixes this scenario by just releasing
acpi_gbl_hardware_lock before calling acpi_ev_walk_gpe_list.

 Changes since v0(https://lkml.org/lkml/2011/9/21/355):
	- Fix changelog, thanks to Lin Ming.

 Changes since v1 (https://lkml.org/lkml/2011/11/3/89):
	- Update changelog and rename goto label, courtesy Srivatsa S. Bhat.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/acpica/hwregs.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 55accb7..cc70f3f 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -269,16 +269,17 @@ acpi_status acpi_hw_clear_acpi_status(void)
 
 	status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
 					ACPI_BITMASK_ALL_FIXED_STATUS);
-	if (ACPI_FAILURE(status)) {
-		goto unlock_and_exit;
-	}
+
+	acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
+
+	if (ACPI_FAILURE(status))
+		goto exit;
 
 	/* Clear the GPE Bits in all GPE registers in all GPE blocks */
 
 	status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
 
-      unlock_and_exit:
-	acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
+exit:
 	return_ACPI_STATUS(status);
 }
 
-- 
1.7.7.rc0.72.g4b5ea

  parent reply	other threads:[~2011-11-07  4:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07  4:11 ACPI & PM patch queue for Linux 3.2 Len Brown
2011-11-07  4:11 ` [PATCH 01/14] tools/power turbostat: less verbose debugging Len Brown
2011-11-07  4:11   ` [PATCH 02/14] mrst pmu: update comment Len Brown
2011-11-07  4:11   ` [PATCH 03/14] ACPI: use kstrdup() Len Brown
2011-11-07  4:11   ` Len Brown [this message]
2011-11-07  4:11   ` [PATCH 05/14] PNPACPI: Simplify disabled resource registration Len Brown
2011-11-07  4:11   ` [PATCH 06/14] ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast() Len Brown
2011-11-07  4:11   ` [PATCH 07/14] ACPI: Drop ACPI_NO_HARDWARE_INIT Len Brown
2011-11-07  4:11   ` [PATCH 08/14] thermal: Prevent polling from happening during system suspend Len Brown
2011-11-07  4:11   ` [PATCH 09/14] ACPI: Export FADT pm_profile integer value to userspace Len Brown
2011-11-07  4:12   ` [PATCH 10/14] ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning Len Brown
2011-11-07  4:12   ` [PATCH 11/14] cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state Len Brown
2011-11-07  4:12   ` [PATCH 12/14] cpuidle: Remove CPUIDLE_FLAG_IGNORE and dev->prepare() Len Brown
2011-11-07  4:12   ` [PATCH 13/14] cpuidle: Split cpuidle_state structure and move per-cpu statistics fields Len Brown
2011-11-07  4:12   ` [PATCH 14/14] cpuidle: Single/Global registration of idle states Len Brown
2011-11-08  0:16 ` ACPI & PM patch queue for Linux 3.2 Thomas Renninger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7f71cfbf0c276ee3d8d856d0f35a41aed997fa4.1320636776.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rakib.mullick@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).