From: Oleg Nesterov Date: Mon, 2 Feb 2015 14:05:36 +0000 (+0100) Subject: locking/futex: Check PF_KTHREAD rather than !p->mm to filter out kthreads X-Git-Tag: omap-for-v4.1/fixes-rc1~199^2~13 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a21294644623ee41034db60e93aaebed4db0e57b;p=pandora-kernel.git locking/futex: Check PF_KTHREAD rather than !p->mm to filter out kthreads attach_to_pi_owner() checks p->mm to prevent attaching to kthreads and this looks doubly wrong: 1. It should actually check PF_KTHREAD, kthread can do use_mm(). 2. If this task is not kthread and it is actually the lock owner we can wrongly return -EPERM instead of -ESRCH or retry-if-EAGAIN. And note that this wrong EPERM is the likely case unless the exiting task is (auto)reaped quickly, we check ->mm before PF_EXITING. Signed-off-by: Oleg Nesterov Signed-off-by: Peter Zijlstra (Intel) Cc: Catalin Marinas Cc: Darren Hart Cc: Davidlohr Bueso Cc: Jerome Marchand Cc: Larry Woodman Cc: Linus Torvalds Cc: Mateusz Guzik Link: http://lkml.kernel.org/r/20150202140536.GA26406@redhat.com Signed-off-by: Ingo Molnar --- Reading git-diff-tree failed