locking/futex: Check PF_KTHREAD rather than !p->mm to filter out kthreads
[firefly-linux-kernel-4.4.55.git] / kernel / futex.c
index 4eeb63de7e54e895506e468acbcd4b3bed4271c6..1f6d646eee4aa30dbef8ef77bd70dca3124e387c 100644 (file)
@@ -900,7 +900,7 @@ static int attach_to_pi_owner(u32 uval, union futex_key *key,
        if (!p)
                return -ESRCH;
 
-       if (!p->mm) {
+       if (unlikely(p->flags & PF_KTHREAD)) {
                put_task_struct(p);
                return -EPERM;
        }