]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ipc/sem.c: fix race with concurrent semtimedop() timeouts
authorManfred Spraul <manfred@colorfullife.com>
Tue, 26 Jul 2011 00:11:47 +0000 (17:11 -0700)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:55:00 +0000 (13:55 -0700)
commitef652fd1d50af7236399055d621051aafffd1789
treee274e74382c50c95bc622fcde184376f3329b3ec
parentef8b14b4fd36fbf79a7823b5741fa901755ee62d
ipc/sem.c: fix race with concurrent semtimedop() timeouts

[ upstream commit d694ad62bf539dbb20a0899ac2a954555f9e4a83 ]
 and IPC_RMID

If a semaphore array is removed and in parallel a sleeping task is woken
up (signal or timeout, does not matter), then the woken up task does not
wait until wake_up_sem_queue_do() is completed.  This will cause crashes,
because wake_up_sem_queue_do() will read from a stale pointer.

The fix is simple: Regardless of anything, always call get_queue_result().
This function waits until wake_up_sem_queue_do() has finished it's task.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=27142

Reported-by: Yuriy Yevtukhov <yuriy@ucoz.com>
Reported-by: Harald Laabs <kernel@dasr.de>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <stable@kernel.org> [2.6.35+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
ipc/sem.c