From 37cbd41da09cb39c9896c04ed8baac7526bb9547 Mon Sep 17 00:00:00 2001 From: Kirill Korotaev Date: Thu, 2 Sep 2004 00:42:48 -0700 Subject: [PATCH] fixed pidhashing patch This patch fixes strange and obscure pid implementation in current kernels: - it removes calling of put_task_struct() from detach_pid() under tasklist_lock. This allows to use blocking calls in security_task_free() hooks (in __put_task_struct()). - it saves some space = 5*5 ints = 100 bytes in task_struct - it's smaller and tidy, more straigthforward and doesn't use any knowledge about pids using and assignment. - it removes pid_links and pid_struct doesn't hold reference counters on task_struct. instead, new pid_structs and linked altogether and only one of them is inserted in hash_list. Signed-off-by: Kirill Korotaev (kksx@mail.ru) Signed-off-by: William Irwin Signed-off-by: Linus Torvalds --- kernel/capability.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'kernel/capability.c') diff --git a/kernel/capability.c b/kernel/capability.c index 1c5c35718450..7e864e2ccf6a 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -89,14 +89,12 @@ static inline void cap_set_pg(int pgrp, kernel_cap_t *effective, kernel_cap_t *permitted) { task_t *g, *target; - struct list_head *l; - struct pid *pid; - for_each_task_pid(pgrp, PIDTYPE_PGID, g, l, pid) { + do_each_task_pid(pgrp, PIDTYPE_PGID, g) { target = g; while_each_thread(g, target) security_capset_set(target, effective, inheritable, permitted); - } + } while_each_task_pid(pgrp, PIDTYPE_PGID, g); } /* -- cgit v1.2.3