diff options
Diffstat (limited to 'net/netrom/af_netrom.c')
| -rw-r--r-- | net/netrom/af_netrom.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 3669cb953e6e..1d50f801f181 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | * Copyright Alan Cox GW4PTS (alan@lxorguk.ukuu.org.uk) | 8 | * Copyright Alan Cox GW4PTS (alan@lxorguk.ukuu.org.uk) |
| 9 | * Copyright Darryl Miles G7LED (dlm@g7led.demon.co.uk) | 9 | * Copyright Darryl Miles G7LED (dlm@g7led.demon.co.uk) |
| 10 | */ | 10 | */ |
| 11 | #include <linux/config.h> | ||
| 12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 13 | #include <linux/moduleparam.h> | 12 | #include <linux/moduleparam.h> |
| 14 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
| @@ -67,6 +66,14 @@ static DEFINE_SPINLOCK(nr_list_lock); | |||
| 67 | static const struct proto_ops nr_proto_ops; | 66 | static const struct proto_ops nr_proto_ops; |
| 68 | 67 | ||
| 69 | /* | 68 | /* |
| 69 | * NETROM network devices are virtual network devices encapsulating NETROM | ||
| 70 | * frames into AX.25 which will be sent through an AX.25 device, so form a | ||
| 71 | * special "super class" of normal net devices; split their locks off into a | ||
| 72 | * separate class since they always nest. | ||
| 73 | */ | ||
| 74 | static struct lock_class_key nr_netdev_xmit_lock_key; | ||
| 75 | |||
| 76 | /* | ||
| 70 | * Socket removal during an interrupt is now safe. | 77 | * Socket removal during an interrupt is now safe. |
| 71 | */ | 78 | */ |
| 72 | static void nr_remove_socket(struct sock *sk) | 79 | static void nr_remove_socket(struct sock *sk) |
| @@ -801,7 +808,7 @@ static int nr_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 801 | 808 | ||
| 802 | /* Now attach up the new socket */ | 809 | /* Now attach up the new socket */ |
| 803 | kfree_skb(skb); | 810 | kfree_skb(skb); |
| 804 | sk->sk_ack_backlog--; | 811 | sk_acceptq_removed(sk); |
| 805 | newsock->sk = newsk; | 812 | newsock->sk = newsk; |
| 806 | 813 | ||
| 807 | out: | 814 | out: |
| @@ -986,19 +993,19 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) | |||
| 986 | nr_make->vr = 0; | 993 | nr_make->vr = 0; |
| 987 | nr_make->vl = 0; | 994 | nr_make->vl = 0; |
| 988 | nr_make->state = NR_STATE_3; | 995 | nr_make->state = NR_STATE_3; |
| 989 | sk->sk_ack_backlog++; | 996 | sk_acceptq_added(sk); |
| 990 | |||
| 991 | nr_insert_socket(make); | ||
| 992 | |||
| 993 | skb_queue_head(&sk->sk_receive_queue, skb); | 997 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 994 | 998 | ||
| 995 | nr_start_heartbeat(make); | ||
| 996 | nr_start_idletimer(make); | ||
| 997 | |||
| 998 | if (!sock_flag(sk, SOCK_DEAD)) | 999 | if (!sock_flag(sk, SOCK_DEAD)) |
| 999 | sk->sk_data_ready(sk, skb->len); | 1000 | sk->sk_data_ready(sk, skb->len); |
| 1000 | 1001 | ||
| 1001 | bh_unlock_sock(sk); | 1002 | bh_unlock_sock(sk); |
| 1003 | |||
| 1004 | nr_insert_socket(make); | ||
| 1005 | |||
| 1006 | nr_start_heartbeat(make); | ||
| 1007 | nr_start_idletimer(make); | ||
| 1008 | |||
| 1002 | return 1; | 1009 | return 1; |
| 1003 | } | 1010 | } |
| 1004 | 1011 | ||
| @@ -1383,14 +1390,12 @@ static int __init nr_proto_init(void) | |||
| 1383 | return -1; | 1390 | return -1; |
| 1384 | } | 1391 | } |
| 1385 | 1392 | ||
| 1386 | dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); | 1393 | dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); |
| 1387 | if (dev_nr == NULL) { | 1394 | if (dev_nr == NULL) { |
| 1388 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); | 1395 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); |
| 1389 | return -1; | 1396 | return -1; |
| 1390 | } | 1397 | } |
| 1391 | 1398 | ||
| 1392 | memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device *)); | ||
| 1393 | |||
| 1394 | for (i = 0; i < nr_ndevs; i++) { | 1399 | for (i = 0; i < nr_ndevs; i++) { |
| 1395 | char name[IFNAMSIZ]; | 1400 | char name[IFNAMSIZ]; |
| 1396 | struct net_device *dev; | 1401 | struct net_device *dev; |
| @@ -1408,6 +1413,7 @@ static int __init nr_proto_init(void) | |||
| 1408 | free_netdev(dev); | 1413 | free_netdev(dev); |
| 1409 | goto fail; | 1414 | goto fail; |
| 1410 | } | 1415 | } |
| 1416 | lockdep_set_class(&dev->_xmit_lock, &nr_netdev_xmit_lock_key); | ||
| 1411 | dev_nr[i] = dev; | 1417 | dev_nr[i] = dev; |
| 1412 | } | 1418 | } |
| 1413 | 1419 | ||
