lkml.org 
[lkml]   [2002]   [Dec]   [5]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
Patch in this message
/
DateWed, 04 Dec 2002 23:48:27 -0800
From wli@holomorp ...
Subject[pidhash] [2/4] make cap_set_pg() use for_each_task_pid()
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/
\
 
 \ /
  Last update: 2005-03-22 11:31    [W:0.110 / U:0.080 seconds]
©2003-2008 Jasper Spaans