/* It is called with ipc_ids.rw_mutex and ipcp->lock held.  */
static int ipc_check_perms(struct kern_ipc_perm *ipcp, struct ipc_ops *ops, struct ipc_params *params)
/* It is called with ipc_ids.rw_mutex and ipcp->lock held.  */
static int ipc_check_perms(struct kern_ipc_perm *ipcp, struct ipc_ops *ops, struct ipc_params *params)
{
	int err;
	if (ipcperms(ipcp, params->flg))
		err = -EACCES;
	else {
		err = ops->associate(ipcp, params->flg);
		if (!err)
			err = ipcp->id;
	}
	return err;
}