summaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
authorManfred Spraul <manfred@colorfullife.com>2005-12-23 23:57:41 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-24 12:13:27 -0800
commit6003a93e7bf6c02f33c02976ff364785d4273295 (patch)
treec81c159d6b04f9bffcf9984d5259eb0448683f7d /ipc/sem.c
parenta7c2491a13cc72fc09c062e635b9a77ff6bb4a73 (diff)
downloadlinux-stable-6003a93e7bf6c02f33c02976ff364785d4273295.tar.gz
linux-stable-6003a93e7bf6c02f33c02976ff364785d4273295.tar.bz2
linux-stable-6003a93e7bf6c02f33c02976ff364785d4273295.zip
[PATCH] add missing memory barriers to ipc/sem.c
Two smp_wmb() statements are missing in the sysv sem code: This could cause stack corruptions. The attached patch adds them. Signed-Off-By: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 19af028a3e38..6a16f8edf2b2 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -381,6 +381,7 @@ static void update_queue (struct sem_array * sma)
/* hands-off: q will disappear immediately after
* writing q->status.
*/
+ smb_wmb();
q->status = error;
q = n;
} else {
@@ -461,6 +462,7 @@ static void freeary (struct sem_array *sma, int id)
n = q->next;
q->status = IN_WAKEUP;
wake_up_process(q->sleeper); /* doesn't sleep */
+ smp_wmb();
q->status = -EIDRM; /* hands-off q */
q = n;
}