diff mbox series

um: remove mmap_sem usage from activate_mm()

Message ID 20200604133752.397dedea0758.I7a24aaa26794eb3fa432003c1bf55cbb816489e2@changeid
State Superseded
Headers show
Series um: remove mmap_sem usage from activate_mm() | expand

Commit Message

Johannes Berg June 4, 2020, 11:37 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Lockdep complains about the mmap_sem because we try to
down_write() it while we already hold the task (spin)lock.

Since commit 9bfb23fc4a48 ("sys_unshare: remove the dead
CLONE_THREAD/SIGHAND/VM code") this is no longer called
by sys_unshare(), and thus the only caller of this is
exec_mmap() in fs/exec.c. But in this case, the new mm
is completely new, so it shouldn't be possible to change
it concurrently.

Remove the mmap_sem handling completely.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 arch/um/include/asm/mmu_context.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index b4deb1bfbb68..8a6e1c5e2c22 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -43,13 +43,11 @@  extern void force_flush_all(void);
 static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
 {
 	/*
-	 * This is called by fs/exec.c and sys_unshare()
-	 * when the new ->mm is used for the first time.
+	 * This is called by fs/exec.c when the new ->mm is used
+	 * for the first time.
 	 */
 	__switch_mm(&new->context.id);
-	down_write_nested(&new->mmap_sem, 1);
 	uml_setup_stubs(new);
-	up_write(&new->mmap_sem);
 }
 
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,