summaryrefslogtreecommitdiff
path: root/include/linux/ipc.h
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2017-09-09 02:17:45 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-09 04:26:51 +0300
commit9405c03ee778cd3e353e55fff6e16dfdd9609c02 (patch)
tree197d334b72ecc283c04b3fd80fbf2d5021acc249 /include/linux/ipc.h
parentf74370b86ec1e0ee8a56ba838efe78e21d8dba23 (diff)
downloadlinux-9405c03ee778cd3e353e55fff6e16dfdd9609c02.tar.xz
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. Link: http://lkml.kernel.org/r/1499417992-3238-4-git-send-email-elena.reshetova@intel.com Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David Windsor <dwindsor@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Serge Hallyn <serge@hallyn.com> Cc: <arozansk@redhat.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ipc.h')
-rw-r--r--include/linux/ipc.h3
1 files changed, 2 insertions, 1 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 @@
#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 */