aboutsummaryrefslogtreecommitdiffstats
path: root/net/netrom/af_netrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netrom/af_netrom.c')
-rw-r--r--net/netrom/af_netrom.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 389a4119e1b4..1d50f801f181 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -66,6 +66,14 @@ static DEFINE_SPINLOCK(nr_list_lock);
66static const struct proto_ops nr_proto_ops; 66static const struct proto_ops nr_proto_ops;
67 67
68/* 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 */
74static struct lock_class_key nr_netdev_xmit_lock_key;
75
76/*
69 * Socket removal during an interrupt is now safe. 77 * Socket removal during an interrupt is now safe.
70 */ 78 */
71static void nr_remove_socket(struct sock *sk) 79static void nr_remove_socket(struct sock *sk)
@@ -986,18 +994,18 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
986 nr_make->vl = 0; 994 nr_make->vl = 0;
987 nr_make->state = NR_STATE_3; 995 nr_make->state = NR_STATE_3;
988 sk_acceptq_added(sk); 996 sk_acceptq_added(sk);
989
990 nr_insert_socket(make);
991
992 skb_queue_head(&sk->sk_receive_queue, skb); 997 skb_queue_head(&sk->sk_receive_queue, skb);
993 998
994 nr_start_heartbeat(make);
995 nr_start_idletimer(make);
996
997 if (!sock_flag(sk, SOCK_DEAD)) 999 if (!sock_flag(sk, SOCK_DEAD))
998 sk->sk_data_ready(sk, skb->len); 1000 sk->sk_data_ready(sk, skb->len);
999 1001
1000 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
1001 return 1; 1009 return 1;
1002} 1010}
1003 1011
@@ -1382,14 +1390,12 @@ static int __init nr_proto_init(void)
1382 return -1; 1390 return -1;
1383 } 1391 }
1384 1392
1385 dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); 1393 dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
1386 if (dev_nr == NULL) { 1394 if (dev_nr == NULL) {
1387 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");
1388 return -1; 1396 return -1;
1389 } 1397 }
1390 1398
1391 memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device *));
1392
1393 for (i = 0; i < nr_ndevs; i++) { 1399 for (i = 0; i < nr_ndevs; i++) {
1394 char name[IFNAMSIZ]; 1400 char name[IFNAMSIZ];
1395 struct net_device *dev; 1401 struct net_device *dev;
@@ -1407,6 +1413,7 @@ static int __init nr_proto_init(void)
1407 free_netdev(dev); 1413 free_netdev(dev);
1408 goto fail; 1414 goto fail;
1409 } 1415 }
1416 lockdep_set_class(&dev->_xmit_lock, &nr_netdev_xmit_lock_key);
1410 dev_nr[i] = dev; 1417 dev_nr[i] = dev;
1411 } 1418 }
1412 1419