Commit fa8860d8 authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/network-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents b2520649 525e31f5
......@@ -127,14 +127,17 @@ struct proto_ops {
int offset, size_t size, int flags);
};
struct module;
struct net_proto_family {
int family;
int (*create)(struct socket *sock, int protocol);
int family;
int (*create)(struct socket *sock, int protocol);
/* These are counters for the number of different methods of
each we support */
short authentication;
short encryption;
short encrypt_net;
short authentication;
short encryption;
short encrypt_net;
struct module *owner;
};
struct iovec;
......
......@@ -506,8 +506,13 @@ struct file_operations bad_sock_fops = {
void sock_release(struct socket *sock)
{
if (sock->ops)
if (sock->ops) {
const int family = sock->ops->family;
sock->ops->release(sock);
sock->ops = NULL;
module_put(net_families[family]->owner);
}
if (sock->fasync_list)
printk(KERN_ERR "sock_release: fasync list not empty!\n");
......@@ -1058,11 +1063,12 @@ int sock_create(int family, int type, int protocol, struct socket **res)
sock->type = type;
i = -EBUSY;
if (!try_module_get(net_families[family]->owner))
goto out_release;
if ((i = net_families[family]->create(sock, protocol)) < 0)
{
sock_release(sock);
goto out;
}
goto out_release;
*res = sock;
security_socket_post_create(sock, family, type, protocol);
......@@ -1070,6 +1076,9 @@ int sock_create(int family, int type, int protocol, struct socket **res)
out:
net_family_read_unlock();
return i;
out_release:
sock_release(sock);
goto out;
}
asmlinkage long sys_socket(int family, int type, int protocol)
......
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