ACPI: Ensure lock is acquired before accessing ec struct members
PATCH 1/1 ACPI: Ensure lock is acquired before accessing ec struct members
From: Puneet Kumar <[email protected]>
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 <[email protected]>
References: http://crbug.com/319019
--- drivers/acpi/ec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/ec.c +2 -1
@@ -173,9 +173,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) {
Signature · 1 line
1.7.10.4
Rafael J. Wysocki
AppliedQuoted 9 lines · Olof Johansson
From: Puneet Kumar <[email protected]>
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 <[email protected]>
Quoted 8 lines
Fixes b76b51ba0cef ('ACPI / EC: Add more debug info and trivial code cleanup')References: http://crbug.com/319019
Signed-off-by Puneet Kumar <[email protected]>Reviewed-by Aaron Durbin <[email protected]>[olof: Commit message reworded a bit]Signed-off-by Olof Johansson <[email protected]>Cc Feng Tang <[email protected]>Cc <[email protected]> # 3.8+
Queued up for the next ACPI pull request, thanks guys!
Quoted 21 lines
--- drivers/acpi/ec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/acpi/ec.c +2
-1@@ -173,9 +173,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) {
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.