aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorPuneet Kumar <puneetster@chromium.org>2013-11-15 14:41:29 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-15 17:18:27 -0500
commit36b15875a7819a2ec4cb5748ff7096ad7bd86cbb (patch)
treee5351fc5dac51c8711f4fc1c469bb9d9a45b5a0b /drivers/acpi
parent5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff)
ACPI / EC: Ensure lock is acquired before accessing ec struct members
A bug was introduced by commit b76b51ba0cef ('ACPI / EC: Add more debug info and trivial code cleanup') that erroneously caused the struct member to be accessed before acquiring the required lock. This change fixes it by ensuring the lock acquisition is done first. Found by Aaron Durbin <adurbin@chromium.org> Fixes: b76b51ba0cef ('ACPI / EC: Add more debug info and trivial code cleanup') References: http://crbug.com/319019 Signed-off-by: Puneet Kumar <puneetster@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> [olof: Commit message reworded a bit] Signed-off-by: Olof Johansson <olof@lixom.net> Cc: 3.8+ <stable@vger.kernel.org> # 3.8+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a06d98374705..15986f32009e 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -175,9 +175,10 @@ static void start_transaction(struct acpi_ec *ec)
175static void advance_transaction(struct acpi_ec *ec, u8 status) 175static void advance_transaction(struct acpi_ec *ec, u8 status)
176{ 176{
177 unsigned long flags; 177 unsigned long flags;
178 struct transaction *t = ec->curr; 178 struct transaction *t;
179 179
180 spin_lock_irqsave(&ec->lock, flags); 180 spin_lock_irqsave(&ec->lock, flags);
181 t = ec->curr;
181 if (!t) 182 if (!t)
182 goto unlock; 183 goto unlock;
183 if (t->wlen > t->wi) { 184 if (t->wlen > t->wi) {