ipc-convert-kern_ipc_permrefcount-from-atomic_t-to-refcount_t.patch removed from -mm tree
The patch titled
Subject: ipc: convert kern_ipc_perm.refcount from atomic_t to refcount_t
has been removed from the -mm tree. Its filename was
ipc-convert-kern_ipc_permrefcount-from-atomic_t-to-refcount_t.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Elena Reshetova <[email protected]>
Subject: ipc: convert kern_ipc_perm.refcount from atomic_t to refcount_t
refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations.
---
include/linux/ipc.h | 3 ++- ipc/util.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-)
include/linux/ipc.h renamed from include/linux/ipc.h~ipc-convert-kern_ipc_permrefcount-from-atomic_t-to-refcount_t +2 -1
@@ -4,6 +4,7 @@#include <linux/spinlock.h> #include <linux/uidgid.h> #include <uapi/linux/ipc.h> +#include <linux/refcount.h> #define IPCMNI 32768/* <= MAX_INT limit for ipc arrays (including sysctl changes) */
@@ -22,7 +23,7 @@ struct kern_ipc_perm {void *security;struct rcu_head rcu; - atomic_t refcount; + refcount_t refcount; }____cacheline_aligned_in_smp __randomize_layout;#endif /* _LINUX_IPC_H */
ipc/util.c renamed from ipc/util.c~ipc-convert-kern_ipc_permrefcount-from-atomic_t-to-refcount_t +3 -3
@@ -232,7 +232,7 @@ int ipc_addid(struct ipc_ids *ids, strucidr_preload (GFP_KERNEL ); -atomic_set (&new->refcount,1 ); +refcount_set (&new->refcount,1 );spin_lock_init (&new->lock); new->deleted = false;rcu_read_lock ();
@@ -397,13 +397,13 @@ void ipc_rmid(struct ipc_ids *ids, strucint ipc_rcu_getref (struct kern_ipc_perm *ptr) { -return atomic_inc_not_zero (&ptr->refcount); +return refcount_inc_not_zero (&ptr->refcount); }void ipc_rcu_putref (struct kern_ipc_perm *ptr,void (*func)(struct rcu_head *head)) { -if (!atomic_dec_and_test (&ptr->refcount)) +if (!refcount_dec_and_test (&ptr->refcount))return ;call_rcu (&ptr->rcu, func);
_
Patches currently in -mm which might be from [email protected] are