public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix freeing user_struct in user cache
@ 2010-12-23 12:52 Hillf Danton
  2010-12-24  3:55 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Hillf Danton @ 2010-12-23 12:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman

When racing on adding into user cache, the new allocated from mm slab
is freed without putting user namespace.

Since the user namespace is already operated by getting, putting has
to be issued.

btw, it could be freed out of lock?

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/kernel/user.c	2010-11-01 19:54:12.000000000 +0800
+++ b/kernel/user.c	2010-12-23 20:42:00.000000000 +0800
@@ -158,6 +158,7 @@ struct user_struct *alloc_uid(struct use
 		spin_lock_irq(&uidhash_lock);
 		up = uid_hash_find(uid, hashent);
 		if (up) {
+			put_user_ns(ns);
 			key_put(new->uid_keyring);
 			key_put(new->session_keyring);
 			kmem_cache_free(uid_cachep, new);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-12-31 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23 12:52 [PATCH] fix freeing user_struct in user cache Hillf Danton
2010-12-24  3:55 ` Greg KH
2010-12-24 14:24   ` Hillf Danton
2010-12-24 17:14     ` Greg KH
2010-12-25 13:56       ` Hillf Danton
     [not found]         ` <20101229030936.GA9275@mail.hallyn.com>
2010-12-29 13:55           ` Hillf Danton
2010-12-31 14:25             ` Serge E. Hallyn
2010-12-24 23:56     ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox