Commit c3f6fb6f authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds

ipc/util: drop ipc_rcu_alloc()

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

[manfred@colorfullife.com: Rediff because the memset was temporarily inside ipc_rcu_free()]
Link: http://lkml.kernel.org/r/20170525185107.12869-13-manfred@colorfullife.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 52f90890
...@@ -394,27 +394,6 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) ...@@ -394,27 +394,6 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
ipcp->deleted = true; 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) int ipc_rcu_getref(struct kern_ipc_perm *ptr)
{ {
return atomic_inc_not_zero(&ptr->refcount); return atomic_inc_not_zero(&ptr->refcount);
......
...@@ -112,10 +112,7 @@ int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flg); ...@@ -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. * Objects are reference counted, they start with reference count 1.
* getref increases the refcount, the putref call that reduces the recount * getref increases the refcount, the putref call that reduces the recount
* to 0 schedules the rcu destruction. Caller must guarantee locking. * 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); int ipc_rcu_getref(struct kern_ipc_perm *ptr);
void ipc_rcu_putref(struct kern_ipc_perm *ptr, void ipc_rcu_putref(struct kern_ipc_perm *ptr,
void (*func)(struct rcu_head *head)); void (*func)(struct rcu_head *head));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment