diff options
Diffstat (limited to 'include/linux/cred.h')
-rw-r--r-- | include/linux/cred.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/cred.h b/include/linux/cred.h index 7eb43a038330..f7a30e0099be 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
@@ -145,7 +145,11 @@ struct cred { | |||
145 | struct user_struct *user; /* real user ID subscription */ | 145 | struct user_struct *user; /* real user ID subscription */ |
146 | struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ | 146 | struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ |
147 | struct group_info *group_info; /* supplementary groups for euid/fsgid */ | 147 | struct group_info *group_info; /* supplementary groups for euid/fsgid */ |
148 | struct rcu_head rcu; /* RCU deletion hook */ | 148 | /* RCU deletion */ |
149 | union { | ||
150 | int non_rcu; /* Can we skip RCU deletion? */ | ||
151 | struct rcu_head rcu; /* RCU deletion hook */ | ||
152 | }; | ||
149 | } __randomize_layout; | 153 | } __randomize_layout; |
150 | 154 | ||
151 | extern void __put_cred(struct cred *); | 155 | extern void __put_cred(struct cred *); |
@@ -246,6 +250,7 @@ static inline const struct cred *get_cred(const struct cred *cred) | |||
246 | if (!cred) | 250 | if (!cred) |
247 | return cred; | 251 | return cred; |
248 | validate_creds(cred); | 252 | validate_creds(cred); |
253 | nonconst_cred->non_rcu = 0; | ||
249 | return get_new_cred(nonconst_cred); | 254 | return get_new_cred(nonconst_cred); |
250 | } | 255 | } |
251 | 256 | ||
@@ -257,6 +262,7 @@ static inline const struct cred *get_cred_rcu(const struct cred *cred) | |||
257 | if (!atomic_inc_not_zero(&nonconst_cred->usage)) | 262 | if (!atomic_inc_not_zero(&nonconst_cred->usage)) |
258 | return NULL; | 263 | return NULL; |
259 | validate_creds(cred); | 264 | validate_creds(cred); |
265 | nonconst_cred->non_rcu = 0; | ||
260 | return cred; | 266 | return cred; |
261 | } | 267 | } |
262 | 268 | ||