From: David Howells <dhowells@redhat.com>
To: paulmck@linux.vnet.ibm.com
Cc: dhowells@redhat.com, Al Viro <viro@ZenIV.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: fix rcu annotations noise in cred.h
Date: Mon, 08 Aug 2011 13:54:08 +0100 [thread overview]
Message-ID: <13642.1312808048@redhat.com> (raw)
In-Reply-To: <20110808123442.GF2385@linux.vnet.ibm.com>
Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> This is indeed what rcu_dereference_protected() is intended for.
How about the attached patch?
David
---
From: David Howells <dhowells@redhat.com>
Subject: [PATCH] CRED: Restore const to current_cred()
Commit 3295514841c2112d94451ba5deaf54f5afb78ea9 accidentally dropped the const
of current->cred inside current_cred() by the insertion of a cast to deal with
an RCU annotation loss warning from sparce.
Use an appropriate RCU wrapper instead so as not to lose the const.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Al Viro <viro@zeniv.linux.org.uk>
---
include/linux/cred.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 98f46ef..8e2fd44 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -269,7 +269,7 @@ static inline void put_cred(const struct cred *_cred)
* since nobody else can modify it.
*/
#define current_cred() \
- (*(__force struct cred **)¤t->cred)
+ rcu_dereference_protected(current->cred, 1)
/**
* __task_cred - Access a task's objective credentials
next prev parent reply other threads:[~2011-08-08 12:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-07 17:55 fix rcu annotations noise in cred.h Al Viro
2011-08-08 8:18 ` David Howells
2011-08-08 8:28 ` Al Viro
2011-08-08 12:34 ` Paul E. McKenney
2011-08-08 12:54 ` David Howells [this message]
2011-08-08 14:35 ` Paul E. McKenney
2011-08-08 12:28 ` David Howells
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=13642.1312808048@redhat.com \
--to=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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