diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/user.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/user.c b/kernel/user.c index d9deae43a9ab..2116642f42c6 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -105,15 +105,19 @@ void free_uid(struct user_struct *up) | |||
105 | { | 105 | { |
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | 107 | ||
108 | if (!up) | ||
109 | return; | ||
110 | |||
108 | local_irq_save(flags); | 111 | local_irq_save(flags); |
109 | if (up && atomic_dec_and_lock(&up->__count, &uidhash_lock)) { | 112 | if (atomic_dec_and_lock(&up->__count, &uidhash_lock)) { |
110 | uid_hash_remove(up); | 113 | uid_hash_remove(up); |
114 | spin_unlock_irqrestore(&uidhash_lock, flags); | ||
111 | key_put(up->uid_keyring); | 115 | key_put(up->uid_keyring); |
112 | key_put(up->session_keyring); | 116 | key_put(up->session_keyring); |
113 | kmem_cache_free(uid_cachep, up); | 117 | kmem_cache_free(uid_cachep, up); |
114 | spin_unlock(&uidhash_lock); | 118 | } else { |
119 | local_irq_restore(flags); | ||
115 | } | 120 | } |
116 | local_irq_restore(flags); | ||
117 | } | 121 | } |
118 | 122 | ||
119 | struct user_struct * alloc_uid(uid_t uid) | 123 | struct user_struct * alloc_uid(uid_t uid) |