diff options
Diffstat (limited to 'ipc/util.h')
-rw-r--r-- | ipc/util.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ipc/util.h b/ipc/util.h index 59d78aa94987..d05b7085a887 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -185,6 +185,19 @@ static inline void ipc_unlock(struct kern_ipc_perm *perm) | |||
185 | rcu_read_unlock(); | 185 | rcu_read_unlock(); |
186 | } | 186 | } |
187 | 187 | ||
188 | /* | ||
189 | * ipc_valid_object() - helper to sort out IPC_RMID races for codepaths | ||
190 | * where the respective ipc_ids.rwsem is not being held down. | ||
191 | * Checks whether the ipc object is still around or if it's gone already, as | ||
192 | * ipc_rmid() may have already freed the ID while the ipc lock was spinning. | ||
193 | * Needs to be called with kern_ipc_perm.lock held -- exception made for one | ||
194 | * checkpoint case at sys_semtimedop() as noted in code commentary. | ||
195 | */ | ||
196 | static inline bool ipc_valid_object(struct kern_ipc_perm *perm) | ||
197 | { | ||
198 | return perm->deleted == 0; | ||
199 | } | ||
200 | |||
188 | struct kern_ipc_perm *ipc_obtain_object_check(struct ipc_ids *ids, int id); | 201 | struct kern_ipc_perm *ipc_obtain_object_check(struct ipc_ids *ids, int id); |
189 | int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids, | 202 | int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids, |
190 | struct ipc_ops *ops, struct ipc_params *params); | 203 | struct ipc_ops *ops, struct ipc_params *params); |