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/sem.c') 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 From 1224b375ed7982128602a3fa1da53eeeac1750b4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 24 Dec 2005 12:19:38 -0800 Subject: Fix silly typo ("smb" vs "smp") Introduced by commit 6003a93e7bf6c02f33c02976ff364785d4273295 --- ipc/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipc/sem.c') diff --git a/ipc/sem.c b/ipc/sem.c index 6a16f8edf2b2..cb5bb2a5df96 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -381,7 +381,7 @@ static void update_queue (struct sem_array * sma) /* hands-off: q will disappear immediately after * writing q->status. */ - smb_wmb(); + smp_wmb(); q->status = error; q = n; } else { -- cgit v1.2.2