Skip to contentSkip to conversation

bug in acpi_os_wait_semaphore

PATCH In review Sebastian Seifert 2 participants 2 messages Mar 3, 2004 – Mar 6, 2004 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug in acpi_os_wait_semaphore

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):

osl.c 2004-03-03 15:11:11.000000000 +0100 renamed from ../../linux-2.6.3-nopreempt/drivers/acpi/osl.c 2004-03-03 10:37:10.000000000 +0100 +1 -1
@@ -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

Signature · 9 lines
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
#2 lore raw
In reply to a message not in the archive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Quoted 3 lines · Sebastian Seifert

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.

I've a problem with 'acpi_os_wait_semaphore':
=====

[email protected]:/usr/src$ dmesg | tail -n 5
     osl-0909 [1212919] os_wait_semaphore     : Failed to acquire
semaphore[dff3e600|1|0], AE_TIME
     osl-0909 [1213627] os_wait_semaphore     : Failed to acquire
semaphore[dff3e600|1|0], AE_TIME
     osl-0909 [1213649] os_wait_semaphore     : Failed to acquire
semaphore[dff3e600|1|0], AE_TIME
     osl-0909 [1219462] os_wait_semaphore     : Failed to acquire
semaphore[dff3e600|1|0], AE_TIME
     osl-0909 [1219483] os_wait_semaphore     : Failed to acquire
semaphore[dff3e600|1|0], AE_TIME
[email protected]:/usr/src$
=====

Could your patch solve it?

Thx, bye,
Gismo / Luca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFASdN4VAp7Xm10JmkRAu3oAJwLev6mvIlrkNsEWHM+HwmybuVtqACfWeHp UayMAyMXnm5xF08cn2FXqeI=
=cXYE
-----END PGP SIGNATURE-----

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click