mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wli@holomorphy.com
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu
Subject: [pidhash] [2/4] make cap_set_pg() use for_each_task_pid()
Date: Wed, 04 Dec 2002 23:48:27 -0800	[thread overview]
Message-ID: <0212042348.YbGc0avcIbVdPbDdOcLb4dba4d.aQaVd15950@holomorphy.com> (raw)
In-Reply-To: <0212042348.MagbHaKdKcEaTd3dPb5dTdIcCb8dWbca15950@holomorphy.com>

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);
+	}
 }
 
 /*

  reply	other threads:[~2002-12-05  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-05  7:48 [pidhash] [0/4] patch series vs. 2.5.50-mm1 wli
2002-12-05  7:48 ` [pidhash] [1/4] Make __do_SAK() use for_each_task_pid() wli
2002-12-05  7:48   ` wli [this message]
2002-12-05  7:48     ` [pidhash] [3/4] eliminate proc_fill_super() tasklist iteration wli
2002-12-05  7:48       ` [pidhash] [5/4] make get_pid_list() scan the PID bitmap wli
2002-12-05  8:50 ` [pidhash] [0/4] patch series vs. 2.5.50-mm1 William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0212042348.YbGc0avcIbVdPbDdOcLb4dba4d.aQaVd15950@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®