aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/cred.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 48e82af1159b..98f46efbe2d2 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -265,10 +265,11 @@ static inline void put_cred(const struct cred *_cred)
265/** 265/**
266 * current_cred - Access the current task's subjective credentials 266 * current_cred - Access the current task's subjective credentials
267 * 267 *
268 * Access the subjective credentials of the current task. 268 * Access the subjective credentials of the current task. RCU-safe,
269 * since nobody else can modify it.
269 */ 270 */
270#define current_cred() \ 271#define current_cred() \
271 (current->cred) 272 (*(__force struct cred **)&current->cred)
272 273
273/** 274/**
274 * __task_cred - Access a task's objective credentials 275 * __task_cred - Access a task's objective credentials
@@ -307,7 +308,7 @@ static inline void put_cred(const struct cred *_cred)
307({ \ 308({ \
308 struct user_struct *__u; \ 309 struct user_struct *__u; \
309 struct cred *__cred; \ 310 struct cred *__cred; \
310 __cred = (struct cred *) current_cred(); \ 311 __cred = current_cred(); \
311 __u = get_uid(__cred->user); \ 312 __u = get_uid(__cred->user); \
312 __u; \ 313 __u; \
313}) 314})
@@ -322,7 +323,7 @@ static inline void put_cred(const struct cred *_cred)
322({ \ 323({ \
323 struct group_info *__groups; \ 324 struct group_info *__groups; \
324 struct cred *__cred; \ 325 struct cred *__cred; \
325 __cred = (struct cred *) current_cred(); \ 326 __cred = current_cred(); \
326 __groups = get_group_info(__cred->group_info); \ 327 __groups = get_group_info(__cred->group_info); \
327 __groups; \ 328 __groups; \
328}) 329})
@@ -341,7 +342,7 @@ static inline void put_cred(const struct cred *_cred)
341 342
342#define current_cred_xxx(xxx) \ 343#define current_cred_xxx(xxx) \
343({ \ 344({ \
344 current->cred->xxx; \ 345 current_cred()->xxx; \
345}) 346})
346 347
347#define current_uid() (current_cred_xxx(uid)) 348#define current_uid() (current_cred_xxx(uid))