diff options
-rw-r--r-- | include/linux/ipc.h | 3 | ||||
-rw-r--r-- | ipc/util.c | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h index fadd579d577d..ae68980e9d48 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/uidgid.h> | 5 | #include <linux/uidgid.h> |
6 | #include <uapi/linux/ipc.h> | 6 | #include <uapi/linux/ipc.h> |
7 | #include <linux/refcount.h> | ||
7 | 8 | ||
8 | #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ | 9 | #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ |
9 | 10 | ||
@@ -22,7 +23,7 @@ struct kern_ipc_perm { | |||
22 | void *security; | 23 | void *security; |
23 | 24 | ||
24 | struct rcu_head rcu; | 25 | struct rcu_head rcu; |
25 | atomic_t refcount; | 26 | refcount_t refcount; |
26 | } ____cacheline_aligned_in_smp __randomize_layout; | 27 | } ____cacheline_aligned_in_smp __randomize_layout; |
27 | 28 | ||
28 | #endif /* _LINUX_IPC_H */ | 29 | #endif /* _LINUX_IPC_H */ |
diff --git a/ipc/util.c b/ipc/util.c index 1a2cb02467ab..069bb22c9f64 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -232,7 +232,7 @@ int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int size) | |||
232 | 232 | ||
233 | idr_preload(GFP_KERNEL); | 233 | idr_preload(GFP_KERNEL); |
234 | 234 | ||
235 | atomic_set(&new->refcount, 1); | 235 | refcount_set(&new->refcount, 1); |
236 | spin_lock_init(&new->lock); | 236 | spin_lock_init(&new->lock); |
237 | new->deleted = false; | 237 | new->deleted = false; |
238 | rcu_read_lock(); | 238 | rcu_read_lock(); |
@@ -397,13 +397,13 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) | |||
397 | 397 | ||
398 | int ipc_rcu_getref(struct kern_ipc_perm *ptr) | 398 | int ipc_rcu_getref(struct kern_ipc_perm *ptr) |
399 | { | 399 | { |
400 | return atomic_inc_not_zero(&ptr->refcount); | 400 | return refcount_inc_not_zero(&ptr->refcount); |
401 | } | 401 | } |
402 | 402 | ||
403 | void ipc_rcu_putref(struct kern_ipc_perm *ptr, | 403 | void ipc_rcu_putref(struct kern_ipc_perm *ptr, |
404 | void (*func)(struct rcu_head *head)) | 404 | void (*func)(struct rcu_head *head)) |
405 | { | 405 | { |
406 | if (!atomic_dec_and_test(&ptr->refcount)) | 406 | if (!refcount_dec_and_test(&ptr->refcount)) |
407 | return; | 407 | return; |
408 | 408 | ||
409 | call_rcu(&ptr->rcu, func); | 409 | call_rcu(&ptr->rcu, func); |