[pidhash] [2/4] make cap_set_pg() use for_each_task_pid()

From: wli@holomorphy.com
Date: Thu Dec 05 2002 - 02:48:27 EST


capset_set_pg() hunts for a task with the right pgrp. It neither wants
nor needs to examine all tasks.

 capability.c | 16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff -urpN mm1-2.5.50-4/kernel/capability.c mm1-2.5.50-5/kernel/capability.c
--- mm1-2.5.50-4/kernel/capability.c 2002-11-27 14:35:50.000000000 -0800
+++ mm1-2.5.50-5/kernel/capability.c 2002-12-04 14:55:10.000000000 -0800
@@ -84,13 +84,15 @@ static inline void cap_set_pg(int pgrp,
                               kernel_cap_t *inheritable,
                               kernel_cap_t *permitted)
 {
- task_t *g, *target;
-
- do_each_thread(g, target) {
- if (target->pgrp != pgrp)
- continue;
- security_capset_set(target, effective, inheritable, permitted);
- } while_each_thread(g, target);
+ task_t *g, *target;
+ struct list_head *l;
+ struct pid *pid;
+
+ for_each_task_pid(pgrp, PIDTYPE_PGID, g, l, pid) {
+ target = g;
+ while_each_thread(g, target)
+ security_capset_set(target, effective, inheritable, permitted);
+ }
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:22 EST