Commit 2934cf26 authored by Puneet Kumar's avatar Puneet Kumar Committed by Ben Hutchings

ACPI / EC: Ensure lock is acquired before accessing ec struct members

commit 36b15875 upstream.

A bug was introduced by commit b76b51ba ('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: b76b51ba ('ACPI / EC: Add more debug info and trivial code cleanup')
References: http://crbug.com/319019Signed-off-by: default avatarPuneet Kumar <puneetster@chromium.org>
Reviewed-by: default avatarAaron Durbin <adurbin@chromium.org>
[olof: Commit message reworded a bit]
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent d5c85f63
......@@ -178,9 +178,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->curr_lock, flags);
t = ec->curr;
if (!t)
goto unlock;
if (t->wlen > t->wi) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment