diff options
Diffstat (limited to 'net/atm/clip.c')
-rw-r--r-- | net/atm/clip.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c index 7af2c411da82..5f8a1d222720 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include "common.h" | 39 | #include "common.h" |
40 | #include "resources.h" | 40 | #include "resources.h" |
41 | #include "ipcommon.h" | ||
42 | #include <net/atmclip.h> | 41 | #include <net/atmclip.h> |
43 | 42 | ||
44 | 43 | ||
@@ -54,7 +53,7 @@ static struct atm_vcc *atmarpd; | |||
54 | static struct neigh_table clip_tbl; | 53 | static struct neigh_table clip_tbl; |
55 | static struct timer_list idle_timer; | 54 | static struct timer_list idle_timer; |
56 | 55 | ||
57 | static int to_atmarpd(enum atmarp_ctrl_type type, int itf, unsigned long ip) | 56 | static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) |
58 | { | 57 | { |
59 | struct sock *sk; | 58 | struct sock *sk; |
60 | struct atmarp_ctrl *ctrl; | 59 | struct atmarp_ctrl *ctrl; |
@@ -220,7 +219,7 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
220 | || memcmp(skb->data, llc_oui, sizeof (llc_oui))) | 219 | || memcmp(skb->data, llc_oui, sizeof (llc_oui))) |
221 | skb->protocol = htons(ETH_P_IP); | 220 | skb->protocol = htons(ETH_P_IP); |
222 | else { | 221 | else { |
223 | skb->protocol = ((u16 *) skb->data)[3]; | 222 | skb->protocol = ((__be16 *) skb->data)[3]; |
224 | skb_pull(skb, RFC1483LLC_LEN); | 223 | skb_pull(skb, RFC1483LLC_LEN); |
225 | if (skb->protocol == htons(ETH_P_ARP)) { | 224 | if (skb->protocol == htons(ETH_P_ARP)) { |
226 | PRIV(skb->dev)->stats.rx_packets++; | 225 | PRIV(skb->dev)->stats.rx_packets++; |
@@ -430,7 +429,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
430 | 429 | ||
431 | here = skb_push(skb, RFC1483LLC_LEN); | 430 | here = skb_push(skb, RFC1483LLC_LEN); |
432 | memcpy(here, llc_oui, sizeof(llc_oui)); | 431 | memcpy(here, llc_oui, sizeof(llc_oui)); |
433 | ((u16 *) here)[3] = skb->protocol; | 432 | ((__be16 *) here)[3] = skb->protocol; |
434 | } | 433 | } |
435 | atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | 434 | atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); |
436 | ATM_SKB(skb)->atm_options = vcc->atm_options; | 435 | ATM_SKB(skb)->atm_options = vcc->atm_options; |
@@ -469,8 +468,9 @@ static struct net_device_stats *clip_get_stats(struct net_device *dev) | |||
469 | static int clip_mkip(struct atm_vcc *vcc, int timeout) | 468 | static int clip_mkip(struct atm_vcc *vcc, int timeout) |
470 | { | 469 | { |
471 | struct clip_vcc *clip_vcc; | 470 | struct clip_vcc *clip_vcc; |
472 | struct sk_buff_head copy; | ||
473 | struct sk_buff *skb; | 471 | struct sk_buff *skb; |
472 | struct sk_buff_head *rq; | ||
473 | unsigned long flags; | ||
474 | 474 | ||
475 | if (!vcc->push) | 475 | if (!vcc->push) |
476 | return -EBADFD; | 476 | return -EBADFD; |
@@ -490,10 +490,26 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout) | |||
490 | clip_vcc->old_pop = vcc->pop; | 490 | clip_vcc->old_pop = vcc->pop; |
491 | vcc->push = clip_push; | 491 | vcc->push = clip_push; |
492 | vcc->pop = clip_pop; | 492 | vcc->pop = clip_pop; |
493 | skb_queue_head_init(©); | 493 | |
494 | skb_migrate(&sk_atm(vcc)->sk_receive_queue, ©); | 494 | rq = &sk_atm(vcc)->sk_receive_queue; |
495 | |||
496 | spin_lock_irqsave(&rq->lock, flags); | ||
497 | if (skb_queue_empty(rq)) { | ||
498 | skb = NULL; | ||
499 | } else { | ||
500 | /* NULL terminate the list. */ | ||
501 | rq->prev->next = NULL; | ||
502 | skb = rq->next; | ||
503 | } | ||
504 | rq->prev = rq->next = (struct sk_buff *)rq; | ||
505 | rq->qlen = 0; | ||
506 | spin_unlock_irqrestore(&rq->lock, flags); | ||
507 | |||
495 | /* re-process everything received between connection setup and MKIP */ | 508 | /* re-process everything received between connection setup and MKIP */ |
496 | while ((skb = skb_dequeue(©)) != NULL) | 509 | while (skb) { |
510 | struct sk_buff *next = skb->next; | ||
511 | |||
512 | skb->next = skb->prev = NULL; | ||
497 | if (!clip_devs) { | 513 | if (!clip_devs) { |
498 | atm_return(vcc, skb->truesize); | 514 | atm_return(vcc, skb->truesize); |
499 | kfree_skb(skb); | 515 | kfree_skb(skb); |
@@ -506,10 +522,13 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout) | |||
506 | PRIV(skb->dev)->stats.rx_bytes -= len; | 522 | PRIV(skb->dev)->stats.rx_bytes -= len; |
507 | kfree_skb(skb); | 523 | kfree_skb(skb); |
508 | } | 524 | } |
525 | |||
526 | skb = next; | ||
527 | } | ||
509 | return 0; | 528 | return 0; |
510 | } | 529 | } |
511 | 530 | ||
512 | static int clip_setentry(struct atm_vcc *vcc, u32 ip) | 531 | static int clip_setentry(struct atm_vcc *vcc, __be32 ip) |
513 | { | 532 | { |
514 | struct neighbour *neigh; | 533 | struct neighbour *neigh; |
515 | struct atmarp_entry *entry; | 534 | struct atmarp_entry *entry; |
@@ -752,7 +771,7 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
752 | err = clip_mkip(vcc, arg); | 771 | err = clip_mkip(vcc, arg); |
753 | break; | 772 | break; |
754 | case ATMARP_SETENTRY: | 773 | case ATMARP_SETENTRY: |
755 | err = clip_setentry(vcc, arg); | 774 | err = clip_setentry(vcc, (__force __be32)arg); |
756 | break; | 775 | break; |
757 | case ATMARP_ENCAP: | 776 | case ATMARP_ENCAP: |
758 | err = clip_encap(vcc, arg); | 777 | err = clip_encap(vcc, arg); |