diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 5 | ||||
-rw-r--r-- | include/linux/cred.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 0008dee66514..c9bbcb2a75ae 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -28,6 +28,7 @@ struct css_id; | |||
28 | extern int cgroup_init_early(void); | 28 | extern int cgroup_init_early(void); |
29 | extern int cgroup_init(void); | 29 | extern int cgroup_init(void); |
30 | extern void cgroup_lock(void); | 30 | extern void cgroup_lock(void); |
31 | extern int cgroup_lock_is_held(void); | ||
31 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); | 32 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); |
32 | extern void cgroup_unlock(void); | 33 | extern void cgroup_unlock(void); |
33 | extern void cgroup_fork(struct task_struct *p); | 34 | extern void cgroup_fork(struct task_struct *p); |
@@ -486,7 +487,9 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state( | |||
486 | static inline struct cgroup_subsys_state *task_subsys_state( | 487 | static inline struct cgroup_subsys_state *task_subsys_state( |
487 | struct task_struct *task, int subsys_id) | 488 | struct task_struct *task, int subsys_id) |
488 | { | 489 | { |
489 | return rcu_dereference(task->cgroups->subsys[subsys_id]); | 490 | return rcu_dereference_check(task->cgroups->subsys[subsys_id], |
491 | rcu_read_lock_held() || | ||
492 | cgroup_lock_is_held()); | ||
490 | } | 493 | } |
491 | 494 | ||
492 | static inline struct cgroup* task_cgroup(struct task_struct *task, | 495 | static inline struct cgroup* task_cgroup(struct task_struct *task, |
diff --git a/include/linux/cred.h b/include/linux/cred.h index 4e3387a89cb9..4db09f89b637 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
@@ -280,7 +280,7 @@ static inline void put_cred(const struct cred *_cred) | |||
280 | * task or by holding tasklist_lock to prevent it from being unlinked. | 280 | * task or by holding tasklist_lock to prevent it from being unlinked. |
281 | */ | 281 | */ |
282 | #define __task_cred(task) \ | 282 | #define __task_cred(task) \ |
283 | ((const struct cred *)(rcu_dereference((task)->real_cred))) | 283 | ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock)))) |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * get_task_cred - Get another task's objective credentials | 286 | * get_task_cred - Get another task's objective credentials |