public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Seifert <lathander-Mmb7MZpHnFY@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH] bug in acpi_os_wait_semaphore
Date: Wed, 3 Mar 2004 15:37:25 +0100	[thread overview]
Message-ID: <20040303143725.GA1657@ergo.gotdns.org> (raw)

Hello,

I have found a tiny bug in acpi_os_wait_semaphore, which has caused my mutex
problems. If Acquire is called on a mutex with a non-zero, non-infinity
timeout, a bad return value check will cause the timeout to expire instantly.

Here's a one-line patch against osl.c in 2.6.3-mm4 (I hope that's current
enough):

--- ../../../linux-2.6.3-nopreempt/drivers/acpi/osl.c   2004-03-03 10:37:10.000000000 +0100
+++ osl.c       2004-03-03 15:11:11.000000000 +0100
@@ -892,7 +892,7 @@
                        static const int quantum_ms = 1000/HZ;
 
                        ret = down_trylock(sem);
-                       for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) {
+                       for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
                                current->state = TASK_INTERRUPTIBLE;
                                schedule_timeout(1);
                                ret = down_trylock(sem);


Sebastian

-- 
Man gewoehnt sich an allem, auch am Dativ.



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

             reply	other threads:[~2004-03-03 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-03 14:37 Sebastian Seifert [this message]
     [not found] ` <20040303143725.GA1657-nlVyBo/8EO9N0TnZuCh8vA@public.gmane.org>
2004-03-06 13:34   ` [PATCH] bug in acpi_os_wait_semaphore Luca Capello
  -- strict thread matches above, loose matches on Subject: below --
2004-03-08  1:24 Yu, Luming
2004-03-09 11:42 Ow Mun Heng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040303143725.GA1657@ergo.gotdns.org \
    --to=lathander-mmb7mzphnfy@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox