summaryrefslogtreecommitdiff
path: root/kernel/user.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-07-04 19:38:06 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-04 19:38:06 -0700
commit7fc4c64b2794116ff84ca732342dd20b6588879a (patch)
tree5144c1ca8acf25137ada7085bd02fb73ddf091b8 /kernel/user.c
parent0d98604b2849f0449b15bf0cb90654e949db4cb8 (diff)
[PATCH] fix current->user->__count leak
From: Arvind Kandhare <arvind.kan@wipro.com> When switch_uid is called, the reference count of the new user is incremented twice. I think the increment in the switch_uid is done because of the reparent_to_init() function which does not increase the __count for root user. But if switch_uid is called from any other function, the reference count is already incremented by the caller by calling alloc_uid for the new user. Hence the count is incremented twice. The user struct will not be deleted even when there are no processes holding a reference count for it. This does not cause any problem currently because nothing is dependent on timely deletion of the user struct.
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 592680d8cc68..86bd412b85da 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -126,7 +126,6 @@ void switch_uid(struct user_struct *new_user)
* we should be checking for it. -DaveM
*/
old_user = current->user;
- atomic_inc(&new_user->__count);
atomic_inc(&new_user->processes);
atomic_dec(&old_user->processes);
current->user = new_user;