KVM: PPC: Check if IOMMU page is contained in the pinned physical page
[linux-2.6-microblaze.git] / kernel / signal.c
index 0f865d6..8d8a940 100644 (file)
@@ -1244,19 +1244,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
 {
        struct sighand_struct *sighand;
 
+       rcu_read_lock();
        for (;;) {
-               /*
-                * Disable interrupts early to avoid deadlocks.
-                * See rcu_read_unlock() comment header for details.
-                */
-               local_irq_save(*flags);
-               rcu_read_lock();
                sighand = rcu_dereference(tsk->sighand);
-               if (unlikely(sighand == NULL)) {
-                       rcu_read_unlock();
-                       local_irq_restore(*flags);
+               if (unlikely(sighand == NULL))
                        break;
-               }
+
                /*
                 * This sighand can be already freed and even reused, but
                 * we rely on SLAB_TYPESAFE_BY_RCU and sighand_ctor() which
@@ -1268,15 +1261,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
                 * __exit_signal(). In the latter case the next iteration
                 * must see ->sighand == NULL.
                 */
-               spin_lock(&sighand->siglock);
-               if (likely(sighand == tsk->sighand)) {
-                       rcu_read_unlock();
+               spin_lock_irqsave(&sighand->siglock, *flags);
+               if (likely(sighand == tsk->sighand))
                        break;
-               }
-               spin_unlock(&sighand->siglock);
-               rcu_read_unlock();
-               local_irq_restore(*flags);
+               spin_unlock_irqrestore(&sighand->siglock, *flags);
        }
+       rcu_read_unlock();
 
        return sighand;
 }