Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347AbbESHVV (ORCPT ); Tue, 19 May 2015 03:21:21 -0400 Received: from terminus.zytor.com ([198.137.202.10]:60417 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754198AbbESHVR (ORCPT ); Tue, 19 May 2015 03:21:17 -0400 Date: Tue, 19 May 2015 00:20:45 -0700 From: tip-bot for David Hildenbrand Message-ID: Cc: peterz@infradead.org, mingo@kernel.org, hpa@zytor.com, dahi@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org Reply-To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, dahi@linux.vnet.ibm.com, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org In-Reply-To: <1431359540-32227-10-git-send-email-dahi@linux.vnet.ibm.com> References: <1431359540-32227-10-git-send-email-dahi@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly Git-Commit-ID: d9b9ff8c18891d74dc7076800bde81b774f7d032 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2457 Lines: 70 Commit-ID: d9b9ff8c18891d74dc7076800bde81b774f7d032 Gitweb: http://git.kernel.org/tip/d9b9ff8c18891d74dc7076800bde81b774f7d032 Author: David Hildenbrand AuthorDate: Mon, 11 May 2015 17:52:14 +0200 Committer: Ingo Molnar CommitDate: Tue, 19 May 2015 08:39:16 +0200 sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly Let's explicitly disable/enable preemption in the !CONFIG_SMP version of futex_atomic_cmpxchg_inatomic(), to prepare for pagefault_disable() not touching preemption anymore. This is needed for this function to be callable from both, atomic and non-atomic context. Otherwise we might break mutual exclusion when relying on a get_user()/ put_user() implementation. Reviewed-and-tested-by: Thomas Gleixner Signed-off-by: David Hildenbrand Signed-off-by: Peter Zijlstra (Intel) Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: airlied@linux.ie Cc: akpm@linux-foundation.org Cc: benh@kernel.crashing.org Cc: bigeasy@linutronix.de Cc: borntraeger@de.ibm.com Cc: daniel.vetter@intel.com Cc: heiko.carstens@de.ibm.com Cc: herbert@gondor.apana.org.au Cc: hocko@suse.cz Cc: hughd@google.com Cc: mst@redhat.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: schwidefsky@de.ibm.com Cc: yang.shi@windriver.com Link: http://lkml.kernel.org/r/1431359540-32227-10-git-send-email-dahi@linux.vnet.ibm.com Signed-off-by: Ingo Molnar --- include/asm-generic/futex.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index 3586017..e56272c 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h @@ -107,6 +107,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, { u32 val; + preempt_disable(); if (unlikely(get_user(val, uaddr) != 0)) return -EFAULT; @@ -114,6 +115,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, return -EFAULT; *uval = val; + preempt_enable(); return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/