[PATCH] unshare: Use rcu_assign_pointer when setting sighand
authorEric W. Biederman <[email protected]>
Thu, 16 Mar 2006 17:31:38 +0000 (10:31 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Mar 2006 15:46:59 +0000 (07:46 -0800)
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 <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/fork.c

index ccdfbb16c86d541f035ebb844c372c23eef053d9..46060cb24af0e06a7c21fdb67978f33644abbc3d 100644 (file)
@@ -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;
                }