aboutsummaryrefslogtreecommitdiffstats
path: root/net/netrom
diff options
context:
space:
mode:
Diffstat (limited to 'net/netrom')
-rw-r--r--net/netrom/af_netrom.c12
-rw-r--r--net/netrom/nr_route.c30
2 files changed, 17 insertions, 25 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 297b07a029de..d1fa1d9ffd2e 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -104,10 +104,9 @@ static void nr_remove_socket(struct sock *sk)
104static void nr_kill_by_device(struct net_device *dev) 104static void nr_kill_by_device(struct net_device *dev)
105{ 105{
106 struct sock *s; 106 struct sock *s;
107 struct hlist_node *node;
108 107
109 spin_lock_bh(&nr_list_lock); 108 spin_lock_bh(&nr_list_lock);
110 sk_for_each(s, node, &nr_list) 109 sk_for_each(s, &nr_list)
111 if (nr_sk(s)->device == dev) 110 if (nr_sk(s)->device == dev)
112 nr_disconnect(s, ENETUNREACH); 111 nr_disconnect(s, ENETUNREACH);
113 spin_unlock_bh(&nr_list_lock); 112 spin_unlock_bh(&nr_list_lock);
@@ -149,10 +148,9 @@ static void nr_insert_socket(struct sock *sk)
149static struct sock *nr_find_listener(ax25_address *addr) 148static struct sock *nr_find_listener(ax25_address *addr)
150{ 149{
151 struct sock *s; 150 struct sock *s;
152 struct hlist_node *node;
153 151
154 spin_lock_bh(&nr_list_lock); 152 spin_lock_bh(&nr_list_lock);
155 sk_for_each(s, node, &nr_list) 153 sk_for_each(s, &nr_list)
156 if (!ax25cmp(&nr_sk(s)->source_addr, addr) && 154 if (!ax25cmp(&nr_sk(s)->source_addr, addr) &&
157 s->sk_state == TCP_LISTEN) { 155 s->sk_state == TCP_LISTEN) {
158 bh_lock_sock(s); 156 bh_lock_sock(s);
@@ -170,10 +168,9 @@ found:
170static struct sock *nr_find_socket(unsigned char index, unsigned char id) 168static struct sock *nr_find_socket(unsigned char index, unsigned char id)
171{ 169{
172 struct sock *s; 170 struct sock *s;
173 struct hlist_node *node;
174 171
175 spin_lock_bh(&nr_list_lock); 172 spin_lock_bh(&nr_list_lock);
176 sk_for_each(s, node, &nr_list) { 173 sk_for_each(s, &nr_list) {
177 struct nr_sock *nr = nr_sk(s); 174 struct nr_sock *nr = nr_sk(s);
178 175
179 if (nr->my_index == index && nr->my_id == id) { 176 if (nr->my_index == index && nr->my_id == id) {
@@ -194,10 +191,9 @@ static struct sock *nr_find_peer(unsigned char index, unsigned char id,
194 ax25_address *dest) 191 ax25_address *dest)
195{ 192{
196 struct sock *s; 193 struct sock *s;
197 struct hlist_node *node;
198 194
199 spin_lock_bh(&nr_list_lock); 195 spin_lock_bh(&nr_list_lock);
200 sk_for_each(s, node, &nr_list) { 196 sk_for_each(s, &nr_list) {
201 struct nr_sock *nr = nr_sk(s); 197 struct nr_sock *nr = nr_sk(s);
202 198
203 if (nr->your_index == index && nr->your_id == id && 199 if (nr->your_index == index && nr->your_id == id &&
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 70ffff76a967..b976d5eff2de 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -49,10 +49,9 @@ static struct nr_node *nr_node_get(ax25_address *callsign)
49{ 49{
50 struct nr_node *found = NULL; 50 struct nr_node *found = NULL;
51 struct nr_node *nr_node; 51 struct nr_node *nr_node;
52 struct hlist_node *node;
53 52
54 spin_lock_bh(&nr_node_list_lock); 53 spin_lock_bh(&nr_node_list_lock);
55 nr_node_for_each(nr_node, node, &nr_node_list) 54 nr_node_for_each(nr_node, &nr_node_list)
56 if (ax25cmp(callsign, &nr_node->callsign) == 0) { 55 if (ax25cmp(callsign, &nr_node->callsign) == 0) {
57 nr_node_hold(nr_node); 56 nr_node_hold(nr_node);
58 found = nr_node; 57 found = nr_node;
@@ -67,10 +66,9 @@ static struct nr_neigh *nr_neigh_get_dev(ax25_address *callsign,
67{ 66{
68 struct nr_neigh *found = NULL; 67 struct nr_neigh *found = NULL;
69 struct nr_neigh *nr_neigh; 68 struct nr_neigh *nr_neigh;
70 struct hlist_node *node;
71 69
72 spin_lock_bh(&nr_neigh_list_lock); 70 spin_lock_bh(&nr_neigh_list_lock);
73 nr_neigh_for_each(nr_neigh, node, &nr_neigh_list) 71 nr_neigh_for_each(nr_neigh, &nr_neigh_list)
74 if (ax25cmp(callsign, &nr_neigh->callsign) == 0 && 72 if (ax25cmp(callsign, &nr_neigh->callsign) == 0 &&
75 nr_neigh->dev == dev) { 73 nr_neigh->dev == dev) {
76 nr_neigh_hold(nr_neigh); 74 nr_neigh_hold(nr_neigh);
@@ -114,10 +112,9 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
114 */ 112 */
115 if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) { 113 if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) {
116 struct nr_node *nr_nodet; 114 struct nr_node *nr_nodet;
117 struct hlist_node *node;
118 115
119 spin_lock_bh(&nr_node_list_lock); 116 spin_lock_bh(&nr_node_list_lock);
120 nr_node_for_each(nr_nodet, node, &nr_node_list) { 117 nr_node_for_each(nr_nodet, &nr_node_list) {
121 nr_node_lock(nr_nodet); 118 nr_node_lock(nr_nodet);
122 for (i = 0; i < nr_nodet->count; i++) 119 for (i = 0; i < nr_nodet->count; i++)
123 if (nr_nodet->routes[i].neighbour == nr_neigh) 120 if (nr_nodet->routes[i].neighbour == nr_neigh)
@@ -485,11 +482,11 @@ static int nr_dec_obs(void)
485{ 482{
486 struct nr_neigh *nr_neigh; 483 struct nr_neigh *nr_neigh;
487 struct nr_node *s; 484 struct nr_node *s;
488 struct hlist_node *node, *nodet; 485 struct hlist_node *nodet;
489 int i; 486 int i;
490 487
491 spin_lock_bh(&nr_node_list_lock); 488 spin_lock_bh(&nr_node_list_lock);
492 nr_node_for_each_safe(s, node, nodet, &nr_node_list) { 489 nr_node_for_each_safe(s, nodet, &nr_node_list) {
493 nr_node_lock(s); 490 nr_node_lock(s);
494 for (i = 0; i < s->count; i++) { 491 for (i = 0; i < s->count; i++) {
495 switch (s->routes[i].obs_count) { 492 switch (s->routes[i].obs_count) {
@@ -540,15 +537,15 @@ static int nr_dec_obs(void)
540void nr_rt_device_down(struct net_device *dev) 537void nr_rt_device_down(struct net_device *dev)
541{ 538{
542 struct nr_neigh *s; 539 struct nr_neigh *s;
543 struct hlist_node *node, *nodet, *node2, *node2t; 540 struct hlist_node *nodet, *node2t;
544 struct nr_node *t; 541 struct nr_node *t;
545 int i; 542 int i;
546 543
547 spin_lock_bh(&nr_neigh_list_lock); 544 spin_lock_bh(&nr_neigh_list_lock);
548 nr_neigh_for_each_safe(s, node, nodet, &nr_neigh_list) { 545 nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
549 if (s->dev == dev) { 546 if (s->dev == dev) {
550 spin_lock_bh(&nr_node_list_lock); 547 spin_lock_bh(&nr_node_list_lock);
551 nr_node_for_each_safe(t, node2, node2t, &nr_node_list) { 548 nr_node_for_each_safe(t, node2t, &nr_node_list) {
552 nr_node_lock(t); 549 nr_node_lock(t);
553 for (i = 0; i < t->count; i++) { 550 for (i = 0; i < t->count; i++) {
554 if (t->routes[i].neighbour == s) { 551 if (t->routes[i].neighbour == s) {
@@ -737,11 +734,10 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
737void nr_link_failed(ax25_cb *ax25, int reason) 734void nr_link_failed(ax25_cb *ax25, int reason)
738{ 735{
739 struct nr_neigh *s, *nr_neigh = NULL; 736 struct nr_neigh *s, *nr_neigh = NULL;
740 struct hlist_node *node;
741 struct nr_node *nr_node = NULL; 737 struct nr_node *nr_node = NULL;
742 738
743 spin_lock_bh(&nr_neigh_list_lock); 739 spin_lock_bh(&nr_neigh_list_lock);
744 nr_neigh_for_each(s, node, &nr_neigh_list) { 740 nr_neigh_for_each(s, &nr_neigh_list) {
745 if (s->ax25 == ax25) { 741 if (s->ax25 == ax25) {
746 nr_neigh_hold(s); 742 nr_neigh_hold(s);
747 nr_neigh = s; 743 nr_neigh = s;
@@ -761,7 +757,7 @@ void nr_link_failed(ax25_cb *ax25, int reason)
761 return; 757 return;
762 } 758 }
763 spin_lock_bh(&nr_node_list_lock); 759 spin_lock_bh(&nr_node_list_lock);
764 nr_node_for_each(nr_node, node, &nr_node_list) { 760 nr_node_for_each(nr_node, &nr_node_list) {
765 nr_node_lock(nr_node); 761 nr_node_lock(nr_node);
766 if (nr_node->which < nr_node->count && 762 if (nr_node->which < nr_node->count &&
767 nr_node->routes[nr_node->which].neighbour == nr_neigh) 763 nr_node->routes[nr_node->which].neighbour == nr_neigh)
@@ -1013,16 +1009,16 @@ void __exit nr_rt_free(void)
1013{ 1009{
1014 struct nr_neigh *s = NULL; 1010 struct nr_neigh *s = NULL;
1015 struct nr_node *t = NULL; 1011 struct nr_node *t = NULL;
1016 struct hlist_node *node, *nodet; 1012 struct hlist_node *nodet;
1017 1013
1018 spin_lock_bh(&nr_neigh_list_lock); 1014 spin_lock_bh(&nr_neigh_list_lock);
1019 spin_lock_bh(&nr_node_list_lock); 1015 spin_lock_bh(&nr_node_list_lock);
1020 nr_node_for_each_safe(t, node, nodet, &nr_node_list) { 1016 nr_node_for_each_safe(t, nodet, &nr_node_list) {
1021 nr_node_lock(t); 1017 nr_node_lock(t);
1022 nr_remove_node_locked(t); 1018 nr_remove_node_locked(t);
1023 nr_node_unlock(t); 1019 nr_node_unlock(t);
1024 } 1020 }
1025 nr_neigh_for_each_safe(s, node, nodet, &nr_neigh_list) { 1021 nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
1026 while(s->count) { 1022 while(s->count) {
1027 s->count--; 1023 s->count--;
1028 nr_neigh_put(s); 1024 nr_neigh_put(s);