mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mandeep Singh Baines <msb@chromium.org>
To: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Cc: Mandeep Singh Baines <msb@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Pavel Emelyanov <xemul@openvz.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <kees@chromium.org>
Subject: [PATCH] sys_getppid: add missing rcu_dereference
Date: Tue,  6 Dec 2011 18:43:54 -0800	[thread overview]
Message-ID: <1323225834-23765-1-git-send-email-msb@chromium.org> (raw)

In order to safely dereference current->real_parent inside an
rcu_read_lock, we need an rcu_dereference.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <kees@chromium.org>
---
 kernel/timer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index dbaa624..9c3c62b 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1368,7 +1368,7 @@ SYSCALL_DEFINE0(getppid)
 	int pid;
 
 	rcu_read_lock();
-	pid = task_tgid_vnr(current->real_parent);
+	pid = task_tgid_vnr(rcu_dereference(current->real_parent));
 	rcu_read_unlock();
 
 	return pid;
-- 
1.7.3.1


             reply	other threads:[~2011-12-07  2:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07  2:43 Mandeep Singh Baines [this message]
2011-12-07  2:45 Mandeep Singh Baines
2011-12-07 23:03 ` Kees Cook
2011-12-08  0:24   ` Mandeep Singh Baines
2011-12-08  0:52     ` Paul E. McKenney
2011-12-09  1:04       ` Kees Cook

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=1323225834-23765-1-git-send-email-msb@chromium.org \
    --to=msb@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=kees@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=xemul@openvz.org \
    /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®