Commit c2f15366 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 8a0aa9f7 2c550214
......@@ -68,8 +68,6 @@ void ax25_free_cb(ax25_cb *ax25)
}
kfree(ax25);
MOD_DEC_USE_COUNT;
}
static void ax25_free_sock(struct sock *sk)
......@@ -507,8 +505,6 @@ ax25_cb *ax25_create_cb(void)
if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
return NULL;
MOD_INC_USE_COUNT;
memset(ax25, 0x00, sizeof(*ax25));
skb_queue_head_init(&ax25->write_queue);
......@@ -1912,6 +1908,7 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
static struct net_proto_family ax25_family_ops = {
.family = PF_AX25,
.create = ax25_create,
.owner = THIS_MODULE,
};
static struct proto_ops ax25_proto_ops = {
......
......@@ -1434,7 +1434,7 @@ static void net_tx_action(struct softirq_action *h)
}
#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
int (*br_handle_frame_hook)(struct sk_buff *skb) = NULL;
int (*br_handle_frame_hook)(struct sk_buff *skb);
static __inline__ int handle_bridge(struct sk_buff *skb,
struct packet_type *pt_prev)
......
......@@ -502,7 +502,6 @@ static void econet_destroy_timer(unsigned long data)
if (!atomic_read(&sk->wmem_alloc) && !atomic_read(&sk->rmem_alloc)) {
sk_free(sk);
MOD_DEC_USE_COUNT;
return;
}
......@@ -547,7 +546,6 @@ static int econet_release(struct socket *sock)
}
sk_free(sk);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -566,7 +564,6 @@ static int econet_create(struct socket *sock, int protocol)
return -ESOCKTNOSUPPORT;
sock->state = SS_UNCONNECTED;
MOD_INC_USE_COUNT;
err = -ENOBUFS;
sk = sk_alloc(PF_ECONET, GFP_KERNEL, 1, NULL);
......@@ -591,7 +588,6 @@ static int econet_create(struct socket *sock, int protocol)
out_free:
sk_free(sk);
out:
MOD_DEC_USE_COUNT;
return err;
}
......@@ -693,6 +689,7 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
static struct net_proto_family econet_family_ops = {
.family = PF_ECONET,
.create = econet_create,
.owner = THIS_MODULE,
};
static struct proto_ops SOCKOPS_WRAPPED(econet_ops) = {
......
......@@ -1132,9 +1132,6 @@ static int irda_create(struct socket *sock, int protocol)
self->nslots = DISCOVERY_DEFAULT_SLOTS;
self->daddr = DEV_ADDR_ANY; /* Until we get connected */
self->saddr = 0x0; /* so IrLMP assign us any link */
MOD_INC_USE_COUNT;
return 0;
}
......@@ -1177,9 +1174,6 @@ void irda_destroy_socket(struct irda_sock *self)
}
#endif /* CONFIG_IRDA_ULTRA */
kfree(self);
MOD_DEC_USE_COUNT;
return;
}
/*
......@@ -2409,6 +2403,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
static struct net_proto_family irda_family_ops = {
.family = PF_IRDA,
.create = irda_create,
.owner = THIS_MODULE,
};
static struct proto_ops SOCKOPS_WRAPPED(irda_stream_ops) = {
......
......@@ -63,8 +63,6 @@ static void pfkey_sock_destruct(struct sock *sk)
kfree(pfkey_sk(sk));
atomic_dec(&pfkey_socks_nr);
MOD_DEC_USE_COUNT;
}
static void pfkey_table_grab(void)
......@@ -150,8 +148,6 @@ static int pfkey_create(struct socket *sock, int protocol)
if (protocol != PF_KEY_V2)
return -EPROTONOSUPPORT;
MOD_INC_USE_COUNT;
err = -ENOMEM;
sk = sk_alloc(PF_KEY, GFP_KERNEL, 1, NULL);
if (sk == NULL)
......@@ -176,9 +172,7 @@ static int pfkey_create(struct socket *sock, int protocol)
pfkey_insert(sk);
return 0;
out:
MOD_DEC_USE_COUNT;
return err;
}
......@@ -2792,6 +2786,7 @@ static struct proto_ops pfkey_ops = {
static struct net_proto_family pfkey_family_ops = {
.family = PF_KEY,
.create = pfkey_create,
.owner = THIS_MODULE,
};
#ifdef CONFIG_PROC_FS
......
......@@ -62,34 +62,25 @@ static spinlock_t nr_list_lock;
static struct proto_ops nr_proto_ops;
static void nr_free_sock(struct sock *sk)
{
sk_free(sk);
MOD_DEC_USE_COUNT;
}
static struct sock *nr_alloc_sock(void)
{
struct sock *sk;
nr_cb *nr;
struct sock *sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL);
MOD_INC_USE_COUNT;
if ((sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL)) == NULL)
goto decmod;
if (!sk)
goto out;
nr = nr_sk(sk) = kmalloc(sizeof(*nr), GFP_ATOMIC);
if (!nr)
goto frees;
memset(nr, 0x00, sizeof(*nr));
nr->sk = sk;
out: return sk;
frees: sk_free(sk);
out:
return sk;
frees:
sk_free(sk);
sk = NULL;
decmod: MOD_DEC_USE_COUNT;
goto out;
}
......@@ -300,9 +291,8 @@ void nr_destroy_socket(struct sock *sk)
sk->timer.function = nr_destroy_timer;
sk->timer.data = (unsigned long)sk;
add_timer(&sk->timer);
} else {
nr_free_sock(sk);
}
} else
sk_free(sk);
}
/*
......@@ -1232,6 +1222,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
static struct net_proto_family nr_family_ops = {
.family = PF_NETROM,
.create = nr_create,
.owner = THIS_MODULE,
};
static struct proto_ops nr_proto_ops = {
......
......@@ -170,7 +170,6 @@ static int nr_set_mac_address(struct net_device *dev, void *addr)
static int nr_open(struct net_device *dev)
{
MOD_INC_USE_COUNT;
netif_start_queue(dev);
ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
return 0;
......@@ -180,7 +179,6 @@ static int nr_close(struct net_device *dev)
{
netif_stop_queue(dev);
ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -199,6 +197,7 @@ static struct net_device_stats *nr_get_stats(struct net_device *dev)
int nr_init(struct net_device *dev)
{
SET_MODULE_OWNER(dev);
dev->mtu = NR_MAX_PACKET_SIZE;
dev->hard_start_xmit = nr_xmit;
dev->open = nr_open;
......
......@@ -209,7 +209,6 @@ void packet_sock_destruct(struct sock *sk)
#ifdef PACKET_REFCNT_DEBUG
printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
#endif
MOD_DEC_USE_COUNT;
}
......@@ -939,7 +938,6 @@ static int packet_create(struct socket *sock, int protocol)
return -ESOCKTNOSUPPORT;
sock->state = SS_UNCONNECTED;
MOD_INC_USE_COUNT;
err = -ENOBUFS;
sk = sk_alloc(PF_PACKET, GFP_KERNEL, 1, NULL);
......@@ -992,7 +990,6 @@ static int packet_create(struct socket *sock, int protocol)
out_free:
sk_free(sk);
out:
MOD_DEC_USE_COUNT;
return err;
}
......@@ -1752,6 +1749,7 @@ struct proto_ops packet_ops = {
static struct net_proto_family packet_family_ops = {
.family = PF_PACKET,
.create = packet_create,
.owner = THIS_MODULE,
};
static struct notifier_block packet_netdev_notifier = {
......
......@@ -124,22 +124,13 @@ int rosecmpm(rose_address *addr1, rose_address *addr2, unsigned short mask)
return 0;
}
static void rose_free_sock(struct sock *sk)
{
sk_free(sk);
MOD_DEC_USE_COUNT;
}
static struct sock *rose_alloc_sock(void)
{
struct sock *sk;
rose_cb *rose;
struct sock *sk = sk_alloc(PF_ROSE, GFP_ATOMIC, 1, NULL);
MOD_INC_USE_COUNT;
if ((sk = sk_alloc(PF_ROSE, GFP_ATOMIC, 1, NULL)) == NULL)
goto decmod;
if (!sk)
goto out;
rose = rose_sk(sk) = kmalloc(sizeof(*rose), GFP_ATOMIC);
if (!rose)
......@@ -147,10 +138,11 @@ static struct sock *rose_alloc_sock(void)
memset(rose, 0x00, sizeof(*rose));
rose->sk = sk;
out: return sk;
frees: sk_free(sk);
out:
return sk;
frees:
sk_free(sk);
sk = NULL;
decmod: MOD_DEC_USE_COUNT;
goto out;
}
......@@ -380,9 +372,8 @@ void rose_destroy_socket(struct sock *sk)
sk->timer.function = rose_destroy_timer;
sk->timer.data = (unsigned long)sk;
add_timer(&sk->timer);
} else {
rose_free_sock(sk);
}
} else
sk_free(sk);
}
/*
......@@ -1428,6 +1419,7 @@ static int rose_get_info(char *buffer, char **start, off_t offset, int length)
static struct net_proto_family rose_family_ops = {
.family = PF_ROSE,
.create = rose_create,
.owner = THIS_MODULE,
};
static struct proto_ops rose_proto_ops = {
......
......@@ -135,7 +135,6 @@ static int rose_set_mac_address(struct net_device *dev, void *addr)
static int rose_open(struct net_device *dev)
{
MOD_INC_USE_COUNT;
netif_start_queue(dev);
rose_add_loopback_node((rose_address *)dev->dev_addr);
return 0;
......@@ -145,7 +144,6 @@ static int rose_close(struct net_device *dev)
{
netif_stop_queue(dev);
rose_del_loopback_node((rose_address *)dev->dev_addr);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -169,6 +167,7 @@ static struct net_device_stats *rose_get_stats(struct net_device *dev)
int rose_init(struct net_device *dev)
{
SET_MODULE_OWNER(dev);
dev->mtu = ROSE_MAX_PACKET_SIZE - 2;
dev->hard_start_xmit = rose_xmit;
dev->open = rose_open;
......
......@@ -509,8 +509,6 @@ static struct sock *wanpipe_alloc_socket(void)
wan_opt->tx_timer.data = (unsigned long)sk;
wan_opt->tx_timer.function = wanpipe_delayed_transmit;
MOD_INC_USE_COUNT;
sock_init_data(NULL, sk);
return sk;
}
......@@ -846,7 +844,6 @@ static void wanpipe_destroy_timer(unsigned long data)
}
sock_put(sk);
atomic_dec(&wanpipe_socks_nr);
MOD_DEC_USE_COUNT;
return;
}
......@@ -1032,7 +1029,6 @@ static int wanpipe_release(struct socket *sock)
}
sock_put(sk);
atomic_dec(&wanpipe_socks_nr);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -1197,7 +1193,6 @@ static void wanpipe_kill_sock_timer (unsigned long data)
}
sock_put(sk);
atomic_dec(&wanpipe_socks_nr);
MOD_DEC_USE_COUNT;
return;
}
......@@ -1237,7 +1232,6 @@ static void wanpipe_kill_sock_accept (struct sock *sk)
}
sock_put(sk);
atomic_dec(&wanpipe_socks_nr);
MOD_DEC_USE_COUNT;
return;
}
......@@ -1262,8 +1256,6 @@ static void wanpipe_kill_sock_irq (struct sock *sk)
}
sock_put(sk);
atomic_dec(&wanpipe_socks_nr);
MOD_DEC_USE_COUNT;
return;
}
......@@ -2579,6 +2571,7 @@ struct proto_ops wanpipe_ops = {
static struct net_proto_family wanpipe_family_ops = {
.family = PF_WANPIPE,
.create = wanpipe_create,
.owner = THIS_MODULE,
};
struct notifier_block wanpipe_netdev_notifier = {
......
......@@ -359,10 +359,8 @@ void x25_destroy_socket(struct sock *sk)
sk->timer.function = x25_destroy_timer;
sk->timer.data = (unsigned long)sk;
add_timer(&sk->timer);
} else {
} else
sk_free(sk);
MOD_DEC_USE_COUNT;
}
release_sock(sk);
sock_put(sk);
}
......@@ -442,13 +440,11 @@ static int x25_listen(struct socket *sock, int backlog)
static struct sock *x25_alloc_socket(void)
{
struct sock *sk;
struct x25_opt *x25;
struct sock *sk = sk_alloc(AF_X25, GFP_ATOMIC, 1, NULL);
MOD_INC_USE_COUNT;
if ((sk = sk_alloc(AF_X25, GFP_ATOMIC, 1, NULL)) == NULL)
goto decmod;
if (!sk)
goto out;
x25 = x25_sk(sk) = kmalloc(sizeof(*x25), GFP_ATOMIC);
if (!x25)
......@@ -469,8 +465,6 @@ static struct sock *x25_alloc_socket(void)
frees:
sk_free(sk);
sk = NULL;
decmod:
MOD_DEC_USE_COUNT;
goto out;
}
......@@ -1324,6 +1318,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
struct net_proto_family x25_family_ops = {
.family = AF_X25,
.create = x25_create,
.owner = THIS_MODULE,
};
static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = {
......
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