From: Puneet Kumar Date: Fri, 15 Nov 2013 19:41:29 +0000 (-0800) Subject: ACPI / EC: Ensure lock is acquired before accessing ec struct members X-Git-Tag: v3.13-rc1~28^2~7^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36b15875a7819a2ec4cb5748ff7096ad7bd86cbb;p=kernel%2Fkernel-generic.git 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 Fixes: b76b51ba0cef ('ACPI / EC: Add more debug info and trivial code cleanup') References: http://crbug.com/319019 Signed-off-by: Puneet Kumar Reviewed-by: Aaron Durbin [olof: Commit message reworded a bit] Signed-off-by: Olof Johansson Cc: 3.8+ # 3.8+ Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a06d983..15986f3 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) {