Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
manfred-colorfu authored and Linus Torvalds committed Dec 24, 2005
1 parent a7c2491 commit 6003a93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ipc/sem.c
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6003a93

Please sign in to comment.