summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPuneet Kumar <puneetster@chromium.org>2013-11-15 11:41:29 -0800
committerKamal Mostafa <kamal@canonical.com>2013-12-06 14:28:16 -0800
commitdf8c26083bc79f73e8caa2545a8fe43a43aec570 (patch)
treef9088de4add68297264c30c9e475fe04c853a1b1
parent88056cc7a119790ead7475157ea25b09a2b2b26c (diff)
downloadlinux-rt-df8c26083bc79f73e8caa2545a8fe43a43aec570.tar.gz
ACPI / EC: Ensure lock is acquired before accessing ec struct members
commit 36b15875a7819a2ec4cb5748ff7096ad7bd86cbb upstream. 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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
-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 0b58c9d7745d..97fcfb011f3a 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -175,9 +175,10 @@ static void start_transaction(struct acpi_ec *ec)
static void advance_transaction(struct acpi_ec *ec, u8 status)
{
unsigned long flags;
- struct transaction *t = ec->curr;
+ struct transaction *t;
spin_lock_irqsave(&ec->lock, flags);
+ t = ec->curr;
if (!t)
goto unlock;
if (t->wlen > t->wi) {