linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/9] fs: Add missing rcu protection for __task_cred() in sys_ioprio_get
       [not found] <20091210001308.247025548@linutronix.de>
@ 2009-12-10  0:52 ` Thomas Gleixner
  2009-12-11 13:46 ` David Howells
  1 sibling, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2009-12-10  0:52 UTC (permalink / raw)
  To: LKML
  Cc: Paul E. McKenney, Dipankar Sarma, Ingo Molnar, Peter Zijlstra,
	Oleg Nesterov, Al Viro, James Morris, David Howells,
	Andrew Morton, Linus Torvalds, linux-security-module,
	linux-fsdevel

[-- Attachment #1: fs-fix-missing-rcu-protection-of-__task_cred.patch --]
[-- Type: text/plain, Size: 1112 bytes --]

sys_ioprio_get() accesses __task_cred() without being in a RCU read
side critical section. tasklist_lock is not protecting that when
CONFIG_TREE_PREEMPT_RCU=y.

Add a rcu_read_lock/unlock() section around the code which accesses
__task_cred().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: linux-security-module@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/ioprio.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6-tip/fs/ioprio.c
===================================================================
--- linux-2.6-tip.orig/fs/ioprio.c
+++ linux-2.6-tip/fs/ioprio.c
@@ -230,6 +230,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, 
 			if (!user)
 				break;
 
+			rcu_read_lock();
 			do_each_thread(g, p) {
 				if (__task_cred(p)->uid != user->uid)
 					continue;
@@ -241,6 +242,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, 
 				else
 					ret = ioprio_best(ret, tmpio);
 			} while_each_thread(g, p);
+			rcu_read_unlock();
 
 			if (who)
 				free_uid(user);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 2/9] fs: Add missing rcu protection for __task_cred() in sys_ioprio_get
       [not found] <20091210001308.247025548@linutronix.de>
  2009-12-10  0:52 ` [patch 2/9] fs: Add missing rcu protection for __task_cred() in sys_ioprio_get Thomas Gleixner
@ 2009-12-11 13:46 ` David Howells
  1 sibling, 0 replies; 2+ messages in thread
From: David Howells @ 2009-12-11 13:46 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: dhowells, LKML, Paul E. McKenney, Dipankar Sarma, Ingo Molnar,
	Peter Zijlstra, Oleg Nesterov, Al Viro, James Morris,
	Andrew Morton, Linus Torvalds, linux-security-module,
	linux-fsdevel

Thomas Gleixner <tglx@linutronix.de> wrote:

> sys_ioprio_get() accesses __task_cred() without being in a RCU read
> side critical section. tasklist_lock is not protecting that when
> CONFIG_TREE_PREEMPT_RCU=y.
> 
> Add a rcu_read_lock/unlock() section around the code which accesses
> __task_cred().
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David Howells <dhowells@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-11 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091210001308.247025548@linutronix.de>
2009-12-10  0:52 ` [patch 2/9] fs: Add missing rcu protection for __task_cred() in sys_ioprio_get Thomas Gleixner
2009-12-11 13:46 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).