aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ipc/msgutil.c
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2017-09-08 16:17:38 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 18:26:51 -0700
commita2e0602c36ed9fe042714694dd5a889ecd8cb556 (patch)
treece02930bac1f418d0920726c061ebeee5ca0ec53 /ipc/msgutil.c
parentkcov: support compat processes (diff)
downloadwireguard-linux-a2e0602c36ed9fe042714694dd5a889ecd8cb556.tar.xz
wireguard-linux-a2e0602c36ed9fe042714694dd5a889ecd8cb556.zip
ipc: convert ipc_namespace.count 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-2-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 'ipc/msgutil.c')
-rw-r--r--ipc/msgutil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index bf74eaa5c39f..84598025a6ad 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -29,7 +29,7 @@ DEFINE_SPINLOCK(mq_lock);
* and not CONFIG_IPC_NS.
*/
struct ipc_namespace init_ipc_ns = {
- .count = ATOMIC_INIT(1),
+ .count = REFCOUNT_INIT(1),
.user_ns = &init_user_ns,
.ns.inum = PROC_IPC_INIT_INO,
#ifdef CONFIG_IPC_NS