aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25/af_ax25.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ax25/af_ax25.c')
-rw-r--r--net/ax25/af_ax25.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index a2e0dd047e9f..000695c48583 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -13,7 +13,6 @@
13 * Copyright (C) Hans Alblas PE1AYX (hans@esrac.ele.tue.nl) 13 * Copyright (C) Hans Alblas PE1AYX (hans@esrac.ele.tue.nl)
14 * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr) 14 * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr)
15 */ 15 */
16#include <linux/config.h>
17#include <linux/capability.h> 16#include <linux/capability.h>
18#include <linux/module.h> 17#include <linux/module.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
@@ -146,7 +145,7 @@ struct sock *ax25_find_listener(ax25_address *addr, int digi,
146 ax25_cb *s; 145 ax25_cb *s;
147 struct hlist_node *node; 146 struct hlist_node *node;
148 147
149 spin_lock_bh(&ax25_list_lock); 148 spin_lock(&ax25_list_lock);
150 ax25_for_each(s, node, &ax25_list) { 149 ax25_for_each(s, node, &ax25_list) {
151 if ((s->iamdigi && !digi) || (!s->iamdigi && digi)) 150 if ((s->iamdigi && !digi) || (!s->iamdigi && digi))
152 continue; 151 continue;
@@ -155,12 +154,12 @@ struct sock *ax25_find_listener(ax25_address *addr, int digi,
155 /* If device is null we match any device */ 154 /* If device is null we match any device */
156 if (s->ax25_dev == NULL || s->ax25_dev->dev == dev) { 155 if (s->ax25_dev == NULL || s->ax25_dev->dev == dev) {
157 sock_hold(s->sk); 156 sock_hold(s->sk);
158 spin_unlock_bh(&ax25_list_lock); 157 spin_unlock(&ax25_list_lock);
159 return s->sk; 158 return s->sk;
160 } 159 }
161 } 160 }
162 } 161 }
163 spin_unlock_bh(&ax25_list_lock); 162 spin_unlock(&ax25_list_lock);
164 163
165 return NULL; 164 return NULL;
166} 165}
@@ -175,7 +174,7 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
175 ax25_cb *s; 174 ax25_cb *s;
176 struct hlist_node *node; 175 struct hlist_node *node;
177 176
178 spin_lock_bh(&ax25_list_lock); 177 spin_lock(&ax25_list_lock);
179 ax25_for_each(s, node, &ax25_list) { 178 ax25_for_each(s, node, &ax25_list) {
180 if (s->sk && !ax25cmp(&s->source_addr, my_addr) && 179 if (s->sk && !ax25cmp(&s->source_addr, my_addr) &&
181 !ax25cmp(&s->dest_addr, dest_addr) && 180 !ax25cmp(&s->dest_addr, dest_addr) &&
@@ -186,7 +185,7 @@ struct sock *ax25_get_socket(ax25_address *my_addr, ax25_address *dest_addr,
186 } 185 }
187 } 186 }
188 187
189 spin_unlock_bh(&ax25_list_lock); 188 spin_unlock(&ax25_list_lock);
190 189
191 return sk; 190 return sk;
192} 191}
@@ -236,7 +235,7 @@ void ax25_send_to_raw(ax25_address *addr, struct sk_buff *skb, int proto)
236 struct sk_buff *copy; 235 struct sk_buff *copy;
237 struct hlist_node *node; 236 struct hlist_node *node;
238 237
239 spin_lock_bh(&ax25_list_lock); 238 spin_lock(&ax25_list_lock);
240 ax25_for_each(s, node, &ax25_list) { 239 ax25_for_each(s, node, &ax25_list) {
241 if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 && 240 if (s->sk != NULL && ax25cmp(&s->source_addr, addr) == 0 &&
242 s->sk->sk_type == SOCK_RAW && 241 s->sk->sk_type == SOCK_RAW &&
@@ -249,7 +248,7 @@ void ax25_send_to_raw(ax25_address *addr, struct sk_buff *skb, int proto)
249 kfree_skb(copy); 248 kfree_skb(copy);
250 } 249 }
251 } 250 }
252 spin_unlock_bh(&ax25_list_lock); 251 spin_unlock(&ax25_list_lock);
253} 252}
254 253
255/* 254/*
@@ -487,10 +486,9 @@ ax25_cb *ax25_create_cb(void)
487{ 486{
488 ax25_cb *ax25; 487 ax25_cb *ax25;
489 488
490 if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) 489 if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
491 return NULL; 490 return NULL;
492 491
493 memset(ax25, 0x00, sizeof(*ax25));
494 atomic_set(&ax25->refcount, 1); 492 atomic_set(&ax25->refcount, 1);
495 493
496 skb_queue_head_init(&ax25->write_queue); 494 skb_queue_head_init(&ax25->write_queue);