/* Do a quick check, to make us not go down to netlink_insert() * if protocol already has kernel socket. */ sk = netlink_lookup(unit, 0); if (unlikely(sk)) { sock_put(sk); return NULL; }  
netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len), struct module *module){	struct proto_ops *p_ops;	struct socket *sock;	struct sock *sk;	if (!nl_table)		return NULL;	if (unit<0 || unit>=MAX_LINKS)		return NULL;	/* Do a quick check, to make us not go down to netlink_insert()	 * if protocol already has kernel socket.	 */	sk = netlink_lookup(unit, 0);	if (unlikely(sk)) {		sock_put(sk);		return NULL;	}	if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))		return NULL;	sk = NULL;	if (module) {		/* Every registering protocol implemented in a module needs		 * it's own p_ops, since the socket code cannot deal with		 * module refcounting otherwise.  -HW		 */		p_ops = kmalloc(sizeof(*p_ops), GFP_KERNEL);		if (!p_ops)			goto out_sock_release;		memcpy(p_ops, &netlink_ops, sizeof(*p_ops));		p_ops->owner = module;	} else		p_ops = &netlink_ops;	netlink_table_grab();	nl_table[unit].p_ops = p_ops;	netlink_table_ungrab();	if (netlink_create(sock, unit) < 0) {		sk = NULL;		goto out_kfree_p_ops;	}	sk = sock->sk;	sk->sk_data_ready = netlink_data_ready;	if (input)		nlk_sk(sk)->data_ready = input;	if (netlink_insert(sk, 0)) {		sk = NULL;		goto out_kfree_p_ops;	}	return sk;out_kfree_p_ops:	netlink_table_grab();	if (nl_table[unit].p_ops != &netlink_ops) {		kfree(nl_table[unit].p_ops);		nl_table[unit].p_ops = &netlink_ops;	}	netlink_table_ungrab();out_sock_release:	sock_release(sock);	return sk;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/77247bbb3094246be9d057e7be442cc708f123a8/af_netlink.c/clean/net/netlink/af_netlink.c