diff options
Diffstat (limited to 'net/netrom')
| -rw-r--r-- | net/netrom/af_netrom.c | 30 | ||||
| -rw-r--r-- | net/netrom/nr_dev.c | 1 | ||||
| -rw-r--r-- | net/netrom/nr_route.c | 12 | ||||
| -rw-r--r-- | net/netrom/nr_timer.c | 2 |
4 files changed, 27 insertions, 18 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 | ||
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 621e5586ab03..9b8eb54971ab 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * | 6 | * |
| 7 | * Copyright Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) | 7 | * Copyright Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) |
| 8 | */ | 8 | */ |
| 9 | #include <linux/config.h> | ||
| 10 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 11 | #include <linux/proc_fs.h> | 10 | #include <linux/proc_fs.h> |
| 12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index b3b9097c87c7..c11737f472d6 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c | |||
| @@ -725,15 +725,17 @@ void nr_link_failed(ax25_cb *ax25, int reason) | |||
| 725 | struct nr_node *nr_node = NULL; | 725 | struct nr_node *nr_node = NULL; |
| 726 | 726 | ||
| 727 | spin_lock_bh(&nr_neigh_list_lock); | 727 | spin_lock_bh(&nr_neigh_list_lock); |
| 728 | nr_neigh_for_each(s, node, &nr_neigh_list) | 728 | nr_neigh_for_each(s, node, &nr_neigh_list) { |
| 729 | if (s->ax25 == ax25) { | 729 | if (s->ax25 == ax25) { |
| 730 | nr_neigh_hold(s); | 730 | nr_neigh_hold(s); |
| 731 | nr_neigh = s; | 731 | nr_neigh = s; |
| 732 | break; | 732 | break; |
| 733 | } | 733 | } |
| 734 | } | ||
| 734 | spin_unlock_bh(&nr_neigh_list_lock); | 735 | spin_unlock_bh(&nr_neigh_list_lock); |
| 735 | 736 | ||
| 736 | if (nr_neigh == NULL) return; | 737 | if (nr_neigh == NULL) |
| 738 | return; | ||
| 737 | 739 | ||
| 738 | nr_neigh->ax25 = NULL; | 740 | nr_neigh->ax25 = NULL; |
| 739 | ax25_cb_put(ax25); | 741 | ax25_cb_put(ax25); |
| @@ -743,11 +745,13 @@ void nr_link_failed(ax25_cb *ax25, int reason) | |||
| 743 | return; | 745 | return; |
| 744 | } | 746 | } |
| 745 | spin_lock_bh(&nr_node_list_lock); | 747 | spin_lock_bh(&nr_node_list_lock); |
| 746 | nr_node_for_each(nr_node, node, &nr_node_list) | 748 | nr_node_for_each(nr_node, node, &nr_node_list) { |
| 747 | nr_node_lock(nr_node); | 749 | nr_node_lock(nr_node); |
| 748 | if (nr_node->which < nr_node->count && nr_node->routes[nr_node->which].neighbour == nr_neigh) | 750 | if (nr_node->which < nr_node->count && |
| 751 | nr_node->routes[nr_node->which].neighbour == nr_neigh) | ||
| 749 | nr_node->which++; | 752 | nr_node->which++; |
| 750 | nr_node_unlock(nr_node); | 753 | nr_node_unlock(nr_node); |
| 754 | } | ||
| 751 | spin_unlock_bh(&nr_node_list_lock); | 755 | spin_unlock_bh(&nr_node_list_lock); |
| 752 | nr_neigh_put(nr_neigh); | 756 | nr_neigh_put(nr_neigh); |
| 753 | } | 757 | } |
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c index 75b72d389ba9..ddba1c144260 100644 --- a/net/netrom/nr_timer.c +++ b/net/netrom/nr_timer.c | |||
| @@ -138,8 +138,8 @@ static void nr_heartbeat_expiry(unsigned long param) | |||
| 138 | if (sock_flag(sk, SOCK_DESTROY) || | 138 | if (sock_flag(sk, SOCK_DESTROY) || |
| 139 | (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { | 139 | (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { |
| 140 | sock_hold(sk); | 140 | sock_hold(sk); |
| 141 | nr_destroy_socket(sk); | ||
| 142 | bh_unlock_sock(sk); | 141 | bh_unlock_sock(sk); |
| 142 | nr_destroy_socket(sk); | ||
| 143 | sock_put(sk); | 143 | sock_put(sk); |
| 144 | return; | 144 | return; |
| 145 | } | 145 | } |
