From: Manfred Spraul Date: Fri, 23 Dec 2005 22:57:41 +0000 (+0100) Subject: [PATCH] add missing memory barriers to ipc/sem.c X-Git-Tag: v2.6.15-rc7~9 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6003a93e7bf6c02f33c02976ff364785d4273295;p=linux-2.6 [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 Signed-off-by: Linus Torvalds --- diff --git a/ipc/sem.c b/ipc/sem.c index 19af028a3e..6a16f8edf2 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; }