From 6003a93e7bf6c02f33c02976ff364785d4273295 Mon Sep 17 00:00:00 2001 From: Manfred Spraul Date: Fri, 23 Dec 2005 23:57:41 +0100 Subject: [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 --- ipc/sem.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ipc') 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; } -- cgit v1.2.2