提交 6003a93e 编写于 作者: M Manfred Spraul 提交者: Linus Torvalds

[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: NManfred Spraul <manfred@colorfullife.com>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a7c2491a
...@@ -381,6 +381,7 @@ static void update_queue (struct sem_array * sma) ...@@ -381,6 +381,7 @@ static void update_queue (struct sem_array * sma)
/* hands-off: q will disappear immediately after /* hands-off: q will disappear immediately after
* writing q->status. * writing q->status.
*/ */
smb_wmb();
q->status = error; q->status = error;
q = n; q = n;
} else { } else {
...@@ -461,6 +462,7 @@ static void freeary (struct sem_array *sma, int id) ...@@ -461,6 +462,7 @@ static void freeary (struct sem_array *sma, int id)
n = q->next; n = q->next;
q->status = IN_WAKEUP; q->status = IN_WAKEUP;
wake_up_process(q->sleeper); /* doesn't sleep */ wake_up_process(q->sleeper); /* doesn't sleep */
smp_wmb();
q->status = -EIDRM; /* hands-off q */ q->status = -EIDRM; /* hands-off q */
q = n; q = n;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册