* [PATCH] ACPI: Ensure lock is acquired before accessing ec struct members
@ 2013-11-15 19:41 Olof Johansson
2013-11-15 22:42 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Olof Johansson @ 2013-11-15 19:41 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Len Brown, linux-acpi, linux-kernel, Puneet Kumar,
Olof Johansson, Feng Tang
From: Puneet Kumar <puneetster@chromium.org>
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: Feng Tang <feng.tang@intel.com>
Cc: <stable@vger.kernel.org> # 3.8+
---
drivers/acpi/ec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d5309fd..ba5b56d 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -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) {
--
1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI: Ensure lock is acquired before accessing ec struct members
2013-11-15 19:41 [PATCH] ACPI: Ensure lock is acquired before accessing ec struct members Olof Johansson
@ 2013-11-15 22:42 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2013-11-15 22:42 UTC (permalink / raw)
To: Olof Johansson
Cc: Len Brown, linux-acpi, linux-kernel, Puneet Kumar, Feng Tang
On Friday, November 15, 2013 11:41:29 AM Olof Johansson wrote:
> From: Puneet Kumar <puneetster@chromium.org>
>
> 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: Feng Tang <feng.tang@intel.com>
> Cc: <stable@vger.kernel.org> # 3.8+
Queued up for the next ACPI pull request, thanks guys!
> ---
> drivers/acpi/ec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index d5309fd..ba5b56d 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -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) {
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-15 22:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 19:41 [PATCH] ACPI: Ensure lock is acquired before accessing ec struct members Olof Johansson
2013-11-15 22:42 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®