From: Eric W. Biederman Date: Thu, 16 Mar 2006 17:31:38 +0000 (-0700) Subject: [PATCH] unshare: Use rcu_assign_pointer when setting sighand X-Git-Tag: v2.6.16~19 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e0e8eb54d8ae0c4cfd1d297f6351b08a7f635c5f;p=linux-2.6-omap-h63xx.git [PATCH] unshare: Use rcu_assign_pointer when setting sighand The sighand pointer only needs the rcu_read_lock on the read side. So only depending on task_lock protection when setting this pointer is not enough. We also need a memory barrier to ensure the initialization is seen first. Use rcu_assign_pointer as it does this for us, and clearly documents that we are setting an rcu readable pointer. Signed-off-by: Eric W. Biederman Acked-by: Paul E. McKenney Signed-off-by: Linus Torvalds --- diff --git a/kernel/fork.c b/kernel/fork.c index ccdfbb16c86..46060cb24af 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1569,7 +1569,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags) if (new_sigh) { sigh = current->sighand; - current->sighand = new_sigh; + rcu_assign_pointer(current->sighand, new_sigh); new_sigh = sigh; }