public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add missing memory barriers to ipc/sem.c
@ 2005-12-23 22:57 Manfred Spraul
  2005-12-24 11:38 ` Thomas Backlund
  0 siblings, 1 reply; 2+ messages in thread
From: Manfred Spraul @ 2005-12-23 22:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Jack Steiner, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

Hi Linus,

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>

[-- Attachment #2: patch-ipc-sem-wmb --]
[-- Type: text/plain, Size: 465 bytes --]

--- 2.6/ipc/sem.c	2005-12-19 01:36:54.000000000 +0100
+++ build-2.6/ipc/sem.c	2005-12-23 23:25:17.000000000 +0100
@@ -381,6 +381,7 @@
 			/* hands-off: q will disappear immediately after
 			 * writing q->status.
 			 */
+			smb_wmb();
 			q->status = error;
 			q = n;
 		} else {
@@ -461,6 +462,7 @@
 		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;
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] add missing memory barriers to ipc/sem.c
  2005-12-23 22:57 [PATCH] add missing memory barriers to ipc/sem.c Manfred Spraul
@ 2005-12-24 11:38 ` Thomas Backlund
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Backlund @ 2005-12-24 11:38 UTC (permalink / raw)
  To: linux-kernel

Manfred Spraul wrote:
> Hi Linus,
> 
> 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>
> 
> 
> ------------------------------------------------------------------------
> 
> --- 2.6/ipc/sem.c	2005-12-19 01:36:54.000000000 +0100
> +++ build-2.6/ipc/sem.c	2005-12-23 23:25:17.000000000 +0100
> @@ -381,6 +381,7 @@
>  			/* hands-off: q will disappear immediately after
>  			 * writing q->status.
>  			 */
> +			smb_wmb();

Typo? Shouldn't it be smp_wmb();

>  			q->status = error;
>  			q = n;
>  		} else {
> @@ -461,6 +462,7 @@
>  		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;
>  	}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-24 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-23 22:57 [PATCH] add missing memory barriers to ipc/sem.c Manfred Spraul
2005-12-24 11:38 ` Thomas Backlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox