]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/cred.h
CRED: Fix get_task_cred() and task_state() to not resurrect dead credentials
[net-next-2.6.git] / include / linux / cred.h
index 75c0fa8813088c31148be71b7cbff77670b6e5d0..ce40cbc791e2610f96ba9fef21d137fb87e8dadd 100644 (file)
@@ -153,6 +153,7 @@ struct cred {
 extern void __put_cred(struct cred *);
 extern void exit_creds(struct task_struct *);
 extern int copy_creds(struct task_struct *, unsigned long);
+extern const struct cred *get_task_cred(struct task_struct *);
 extern struct cred *cred_alloc_blank(void);
 extern struct cred *prepare_creds(void);
 extern struct cred *prepare_exec_creds(void);
@@ -281,26 +282,6 @@ static inline void put_cred(const struct cred *_cred)
 #define __task_cred(task) \
        ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_tasklist_lock_is_held())))
 
-/**
- * get_task_cred - Get another task's objective credentials
- * @task: The task to query
- *
- * Get the objective credentials of a task, pinning them so that they can't go
- * away.  Accessing a task's credentials directly is not permitted.
- *
- * The caller must make sure task doesn't go away, either by holding a ref on
- * task or by holding tasklist_lock to prevent it from being unlinked.
- */
-#define get_task_cred(task)                            \
-({                                                     \
-       struct cred *__cred;                            \
-       rcu_read_lock();                                \
-       __cred = (struct cred *) __task_cred((task));   \
-       get_cred(__cred);                               \
-       rcu_read_unlock();                              \
-       __cred;                                         \
-})
-
 /**
  * get_current_cred - Get the current task's subjective credentials
  *