Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650750

[PATCH 12/20] ipc/util: Drop ipc_rcu_alloc()

From Manfred Spraul <manfred@colorfullife.com>
Newsgroups linux.kernel
Subject [PATCH 12/20] ipc/util: Drop ipc_rcu_alloc()
Date 2017-05-25 21:00 +0200
Message-ID <tL69l-3pt-37@gated-at.bofh.it> (permalink)
References <tEZke-1sP-3@gated-at.bofh.it> <tL69k-3pt-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kees Cook <keescook@chromium.org>

No callers remain for ipc_rcu_alloc(). Drop the function.

Signed-off-by: Kees Cook <keescook@chromium.org>

[manfred@colorfullife.com: Rediff because the memset was
temporarily inside ipc_rcu_free()]

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
---
 ipc/util.c | 21 ---------------------
 ipc/util.h |  3 ---
 2 files changed, 24 deletions(-)

diff --git a/ipc/util.c b/ipc/util.c
index 556884b..2428dd4 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -394,27 +394,6 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
 	ipcp->deleted = true;
 }
 
-/**
- * ipc_rcu_alloc - allocate ipc space
- * @size: size desired
- *
- * Allocate memory for an ipc object.
- * The first member must be struct kern_ipc_perm.
- */
-struct kern_ipc_perm *ipc_rcu_alloc(int size)
-{
-	/*
-	 * We prepend the allocation with the rcu struct
-	 */
-	struct kern_ipc_perm *out = kvmalloc(size, GFP_KERNEL);
-	if (unlikely(!out))
-		return NULL;
-
-	memset(out, 0, size);
-	atomic_set(&out->refcount, 1);
-	return out;
-}
-
 int ipc_rcu_getref(struct kern_ipc_perm *ptr)
 {
 	return atomic_inc_not_zero(&ptr->refcount);
diff --git a/ipc/util.h b/ipc/util.h
index 44efbc0..77336c2b 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -112,10 +112,7 @@ int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flg);
  * Objects are reference counted, they start with reference count 1.
  * getref increases the refcount, the putref call that reduces the recount
  * to 0 schedules the rcu destruction. Caller must guarantee locking.
- *
- * struct kern_ipc_perm must be the first member in the allocated structure.
  */
-struct kern_ipc_perm *ipc_rcu_alloc(int size);
 int ipc_rcu_getref(struct kern_ipc_perm *ptr);
 void ipc_rcu_putref(struct kern_ipc_perm *ptr,
 			void (*func)(struct rcu_head *head));
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/20 V3] Misc cleanups for ipc Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 05/20] ipc/sem: Do not use ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 08/20] ipc/util: Drop ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 15/20] ipc/msg.c: Avoid ipc_rcu_putref for failed ipc_addid() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 19/20] ipc/sem: Drop __sem_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 20/20] ipc/util.h: Update documentation for ipc_getref() and ipc_putref() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 09/20] ipc/sem: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 17/20] ipc/shm: Remove special shm_alloc/free Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 11/20] ipc/msg: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 12/20] ipc/util: Drop ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 16/20] ipc: Move atomic_set() to where it is needed Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 04/20] ipc: Drop non-RCU allocation Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
    Re: [PATCH 04/20] ipc: Drop non-RCU allocation Kees Cook <keescook@chromium.org> - 2017-05-25 21:40 +0200
  [PATCH 03/20] include/linux/sem.h: Correctly document sem_ctime Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 07/20] ipc/msg: Do not use ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 10/20] ipc/shm: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  Re: [PATCH 0/20 V3] Misc cleanups for ipc Kees Cook <keescook@chromium.org> - 2017-05-25 21:50 +0200
    Re: [PATCH 0/20 V3] Misc cleanups for ipc Manfred Spraul <manfred@colorfullife.com> - 2017-05-26 04:00 +0200

csiph-web