summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna-Maria Gleixner <anna-maria@linutronix.de>2018-08-22 00:55:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-22 13:52:47 -0400
commitce0a568d327968367f294ea2425fe2c6f4f33ed2 (patch)
tree2c9d314854c059bfed32d69267691bb00d8f2e7a
parentfc37191272a972d449bab3d8247cf52cadf5d4e6 (diff)
userns: use irqsave variant of refcount_dec_and_lock()
The irqsave variant of refcount_dec_and_lock handles irqsave/restore when taking/releasing the spin lock. With this variant the call of local_irq_save/restore is no longer required. [bigeasy@linutronix.de: s@atomic_dec_and_lock@refcount_dec_and_lock@g] Link: http://lkml.kernel.org/r/20180703200141.28415-7-bigeasy@linutronix.de Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/user.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 5f65ef195259..0df9b1640b2a 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -169,11 +169,8 @@ void free_uid(struct user_struct *up)
169 if (!up) 169 if (!up)
170 return; 170 return;
171 171
172 local_irq_save(flags); 172 if (refcount_dec_and_lock_irqsave(&up->__count, &uidhash_lock, &flags))
173 if (refcount_dec_and_lock(&up->__count, &uidhash_lock))
174 free_user(up, flags); 173 free_user(up, flags);
175 else
176 local_irq_restore(flags);
177} 174}
178 175
179struct user_struct *alloc_uid(kuid_t uid) 176struct user_struct *alloc_uid(kuid_t uid)