diff options
-rw-r--r-- | include/linux/ipc.h | 2 | ||||
-rw-r--r-- | ipc/sem.c | 2 | ||||
-rw-r--r-- | ipc/util.c | 6 | ||||
-rw-r--r-- | ipc/util.h | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 8d861b2651f7..9d84942ae2e5 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h | |||
@@ -11,7 +11,7 @@ | |||
11 | struct kern_ipc_perm | 11 | struct kern_ipc_perm |
12 | { | 12 | { |
13 | spinlock_t lock; | 13 | spinlock_t lock; |
14 | int deleted; | 14 | bool deleted; |
15 | int id; | 15 | int id; |
16 | key_t key; | 16 | key_t key; |
17 | kuid_t uid; | 17 | kuid_t uid; |
@@ -394,7 +394,7 @@ static inline struct sem_array *sem_obtain_lock(struct ipc_namespace *ns, | |||
394 | /* ipc_rmid() may have already freed the ID while sem_lock | 394 | /* ipc_rmid() may have already freed the ID while sem_lock |
395 | * was spinning: verify that the structure is still valid | 395 | * was spinning: verify that the structure is still valid |
396 | */ | 396 | */ |
397 | if (!ipcp->deleted) | 397 | if (ipc_valid_object(ipcp)) |
398 | return container_of(ipcp, struct sem_array, sem_perm); | 398 | return container_of(ipcp, struct sem_array, sem_perm); |
399 | 399 | ||
400 | sem_unlock(sma, *locknum); | 400 | sem_unlock(sma, *locknum); |
diff --git a/ipc/util.c b/ipc/util.c index 3ae17a4ace5b..9dc67fa4308c 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -286,7 +286,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) | |||
286 | idr_preload(GFP_KERNEL); | 286 | idr_preload(GFP_KERNEL); |
287 | 287 | ||
288 | spin_lock_init(&new->lock); | 288 | spin_lock_init(&new->lock); |
289 | new->deleted = 0; | 289 | new->deleted = false; |
290 | rcu_read_lock(); | 290 | rcu_read_lock(); |
291 | spin_lock(&new->lock); | 291 | spin_lock(&new->lock); |
292 | 292 | ||
@@ -447,7 +447,7 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) | |||
447 | 447 | ||
448 | ids->in_use--; | 448 | ids->in_use--; |
449 | 449 | ||
450 | ipcp->deleted = 1; | 450 | ipcp->deleted = true; |
451 | 451 | ||
452 | return; | 452 | return; |
453 | } | 453 | } |
@@ -657,7 +657,7 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) | |||
657 | /* ipc_rmid() may have already freed the ID while ipc_lock | 657 | /* ipc_rmid() may have already freed the ID while ipc_lock |
658 | * was spinning: here verify that the structure is still valid | 658 | * was spinning: here verify that the structure is still valid |
659 | */ | 659 | */ |
660 | if (!out->deleted) | 660 | if (ipc_valid_object(out)) |
661 | return out; | 661 | return out; |
662 | 662 | ||
663 | spin_unlock(&out->lock); | 663 | spin_unlock(&out->lock); |
diff --git a/ipc/util.h b/ipc/util.h index d05b7085a887..a1cbc3aaf25a 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -195,7 +195,7 @@ static inline void ipc_unlock(struct kern_ipc_perm *perm) | |||
195 | */ | 195 | */ |
196 | static inline bool ipc_valid_object(struct kern_ipc_perm *perm) | 196 | static inline bool ipc_valid_object(struct kern_ipc_perm *perm) |
197 | { | 197 | { |
198 | return perm->deleted == 0; | 198 | return !perm->deleted; |
199 | } | 199 | } |
200 | 200 | ||
201 | 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); |