mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] CRED: Restore const to current_cred()
@ 2011-08-08 14:54 David Howells
  0 siblings, 0 replies; only message in thread
From: David Howells @ 2011-08-08 14:54 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, linux-security-module, David Howells, Al Viro

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>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.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 **)&current->cred)
+	rcu_dereference_protected(current->cred, 1)
 
 /**
  * __task_cred - Access a task's objective credentials


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-08 14:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08 14:54 [PATCH] CRED: Restore const to current_cred() David Howells

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®