diff options
author | Manfred Spraul <manfred@colorfullife.com> | 2005-12-23 17:57:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-24 15:13:27 -0500 |
commit | 6003a93e7bf6c02f33c02976ff364785d4273295 (patch) | |
tree | c81c159d6b04f9bffcf9984d5259eb0448683f7d | |
parent | a7c2491a13cc72fc09c062e635b9a77ff6bb4a73 (diff) |
[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>
-rw-r--r-- | ipc/sem.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -381,6 +381,7 @@ static void update_queue (struct sem_array * sma) | |||
381 | /* hands-off: q will disappear immediately after | 381 | /* hands-off: q will disappear immediately after |
382 | * writing q->status. | 382 | * writing q->status. |
383 | */ | 383 | */ |
384 | smb_wmb(); | ||
384 | q->status = error; | 385 | q->status = error; |
385 | q = n; | 386 | q = n; |
386 | } else { | 387 | } else { |
@@ -461,6 +462,7 @@ static void freeary (struct sem_array *sma, int id) | |||
461 | n = q->next; | 462 | n = q->next; |
462 | q->status = IN_WAKEUP; | 463 | q->status = IN_WAKEUP; |
463 | wake_up_process(q->sleeper); /* doesn't sleep */ | 464 | wake_up_process(q->sleeper); /* doesn't sleep */ |
465 | smp_wmb(); | ||
464 | q->status = -EIDRM; /* hands-off q */ | 466 | q->status = -EIDRM; /* hands-off q */ |
465 | q = n; | 467 | q = n; |
466 | } | 468 | } |