prctl: take mmap sem for writing to protect against others
[firefly-linux-kernel-4.4.55.git] / kernel / futex.c
index 495a1d06915bec0c48d692154a4ba1539703533f..461c72b2dac2c4d316e66b38b5b7d73d980ab347 100644 (file)
@@ -2755,6 +2755,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
                if (q.pi_state && (q.pi_state->owner != current)) {
                        spin_lock(q.lock_ptr);
                        ret = fixup_pi_state_owner(uaddr2, &q, current);
+                       /*
+                        * Drop the reference to the pi state which
+                        * the requeue_pi() code acquired for us.
+                        */
+                       free_pi_state(q.pi_state);
                        spin_unlock(q.lock_ptr);
                }
        } else {