aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2008-12-15 02:17:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-15 02:17:26 -0500
commit0eae1b98cf3022715b5a6ea5f1ac6b0bd7ac4edd (patch)
tree874de569a7859f855296ee3857ad4214fcbaed29 /net/ax25
parentebad5c0984e06f4036d2eb2741b9afce736b8a06 (diff)
ax25: join the return paths that free skb
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/ax25_in.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 4a5ba978a804..5f1d2107a1dd 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -200,19 +200,15 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
200 200
201 skb_reset_transport_header(skb); 201 skb_reset_transport_header(skb);
202 202
203 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { 203 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
204 kfree_skb(skb); 204 goto free;
205 return 0;
206 }
207 205
208 /* 206 /*
209 * Parse the address header. 207 * Parse the address header.
210 */ 208 */
211 209
212 if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL) { 210 if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL)
213 kfree_skb(skb); 211 goto free;
214 return 0;
215 }
216 212
217 /* 213 /*
218 * Ours perhaps ? 214 * Ours perhaps ?
@@ -239,10 +235,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
239 235
240 ax25_send_to_raw(&dest, skb, skb->data[1]); 236 ax25_send_to_raw(&dest, skb, skb->data[1]);
241 237
242 if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0) { 238 if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0)
243 kfree_skb(skb); 239 goto free;
244 return 0;
245 }
246 240
247 /* Now we are pointing at the pid byte */ 241 /* Now we are pointing at the pid byte */
248 switch (skb->data[1]) { 242 switch (skb->data[1]) {
@@ -301,10 +295,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
301 * If not, should we DM the incoming frame (except DMs) or 295 * If not, should we DM the incoming frame (except DMs) or
302 * silently ignore them. For now we stay quiet. 296 * silently ignore them. For now we stay quiet.
303 */ 297 */
304 if (ax25_dev->values[AX25_VALUES_CONMODE] == 0) { 298 if (ax25_dev->values[AX25_VALUES_CONMODE] == 0)
305 kfree_skb(skb); 299 goto free;
306 return 0;
307 }
308 300
309 /* LAPB */ 301 /* LAPB */
310 302
@@ -339,8 +331,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
339 if ((*skb->data & ~AX25_PF) != AX25_DM && mine) 331 if ((*skb->data & ~AX25_PF) != AX25_DM && mine)
340 ax25_return_dm(dev, &src, &dest, &dp); 332 ax25_return_dm(dev, &src, &dest, &dp);
341 333
342 kfree_skb(skb); 334 goto free;
343 return 0;
344 } 335 }
345 336
346 /* b) received SABM(E) */ 337 /* b) received SABM(E) */
@@ -372,15 +363,12 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
372 sk->sk_ack_backlog++; 363 sk->sk_ack_backlog++;
373 bh_unlock_sock(sk); 364 bh_unlock_sock(sk);
374 } else { 365 } else {
375 if (!mine) { 366 if (!mine)
376 kfree_skb(skb); 367 goto free;
377 return 0;
378 }
379 368
380 if ((ax25 = ax25_create_cb()) == NULL) { 369 if ((ax25 = ax25_create_cb()) == NULL) {
381 ax25_return_dm(dev, &src, &dest, &dp); 370 ax25_return_dm(dev, &src, &dest, &dp);
382 kfree_skb(skb); 371 goto free;
383 return 0;
384 } 372 }
385 373
386 ax25_fillin_cb(ax25, ax25_dev); 374 ax25_fillin_cb(ax25, ax25_dev);
@@ -436,9 +424,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
436 if (!sock_flag(sk, SOCK_DEAD)) 424 if (!sock_flag(sk, SOCK_DEAD))
437 sk->sk_data_ready(sk, skb->len); 425 sk->sk_data_ready(sk, skb->len);
438 sock_put(sk); 426 sock_put(sk);
439 } else 427 } else {
428free:
440 kfree_skb(skb); 429 kfree_skb(skb);
441 430 }
442 return 0; 431 return 0;
443} 432}
444 433