diff options
| -rw-r--r-- | net/phonet/pep.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 875e86cadcfd..40952c7d4308 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
| @@ -522,7 +522,8 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 522 | if (!pn_flow_safe(pn->rx_fc)) { | 522 | if (!pn_flow_safe(pn->rx_fc)) { |
| 523 | err = sock_queue_rcv_skb(sk, skb); | 523 | err = sock_queue_rcv_skb(sk, skb); |
| 524 | if (!err) | 524 | if (!err) |
| 525 | return 0; | 525 | return NET_RX_SUCCESS; |
| 526 | err = -ENOBUFS; | ||
| 526 | break; | 527 | break; |
| 527 | } | 528 | } |
| 528 | 529 | ||
| @@ -575,7 +576,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 575 | } | 576 | } |
| 576 | out: | 577 | out: |
| 577 | kfree_skb(skb); | 578 | kfree_skb(skb); |
| 578 | return err; | 579 | return (err == -ENOBUFS) ? NET_RX_DROP : NET_RX_SUCCESS; |
| 579 | 580 | ||
| 580 | queue: | 581 | queue: |
| 581 | skb->dev = NULL; | 582 | skb->dev = NULL; |
| @@ -584,7 +585,7 @@ queue: | |||
| 584 | skb_queue_tail(queue, skb); | 585 | skb_queue_tail(queue, skb); |
| 585 | if (!sock_flag(sk, SOCK_DEAD)) | 586 | if (!sock_flag(sk, SOCK_DEAD)) |
| 586 | sk->sk_data_ready(sk, err); | 587 | sk->sk_data_ready(sk, err); |
| 587 | return 0; | 588 | return NET_RX_SUCCESS; |
| 588 | } | 589 | } |
| 589 | 590 | ||
| 590 | /* Destroy connected sock. */ | 591 | /* Destroy connected sock. */ |
| @@ -686,11 +687,6 @@ static int pep_connreq_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 686 | } | 687 | } |
| 687 | peer_type = hdr->other_pep_type << 8; | 688 | peer_type = hdr->other_pep_type << 8; |
| 688 | 689 | ||
| 689 | if (unlikely(sk->sk_state != TCP_LISTEN) || sk_acceptq_is_full(sk)) { | ||
| 690 | pep_reject_conn(sk, skb, PN_PIPE_ERR_PEP_IN_USE); | ||
| 691 | return -ENOBUFS; | ||
| 692 | } | ||
| 693 | |||
| 694 | /* Parse sub-blocks (options) */ | 690 | /* Parse sub-blocks (options) */ |
| 695 | n_sb = hdr->data[4]; | 691 | n_sb = hdr->data[4]; |
| 696 | while (n_sb > 0) { | 692 | while (n_sb > 0) { |
| @@ -790,7 +786,6 @@ static int pep_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 790 | struct sock *sknode; | 786 | struct sock *sknode; |
| 791 | struct pnpipehdr *hdr; | 787 | struct pnpipehdr *hdr; |
| 792 | struct sockaddr_pn dst; | 788 | struct sockaddr_pn dst; |
| 793 | int err = NET_RX_SUCCESS; | ||
| 794 | u8 pipe_handle; | 789 | u8 pipe_handle; |
| 795 | 790 | ||
| 796 | if (!pskb_may_pull(skb, sizeof(*hdr))) | 791 | if (!pskb_may_pull(skb, sizeof(*hdr))) |
| @@ -814,18 +809,20 @@ static int pep_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 814 | sock_put(sknode); | 809 | sock_put(sknode); |
| 815 | if (net_ratelimit()) | 810 | if (net_ratelimit()) |
| 816 | printk(KERN_WARNING"Phonet unconnected PEP ignored"); | 811 | printk(KERN_WARNING"Phonet unconnected PEP ignored"); |
| 817 | err = NET_RX_DROP; | ||
| 818 | goto drop; | 812 | goto drop; |
| 819 | } | 813 | } |
| 820 | 814 | ||
| 821 | switch (hdr->message_id) { | 815 | switch (hdr->message_id) { |
| 822 | case PNS_PEP_CONNECT_REQ: | 816 | case PNS_PEP_CONNECT_REQ: |
| 823 | err = pep_connreq_rcv(sk, skb); | 817 | if (sk->sk_state == TCP_LISTEN && !sk_acceptq_is_full(sk)) |
| 818 | pep_connreq_rcv(sk, skb); | ||
| 819 | else | ||
| 820 | pep_reject_conn(sk, skb, PN_PIPE_ERR_PEP_IN_USE); | ||
| 824 | break; | 821 | break; |
| 825 | 822 | ||
| 826 | #ifdef CONFIG_PHONET_PIPECTRLR | 823 | #ifdef CONFIG_PHONET_PIPECTRLR |
| 827 | case PNS_PEP_CONNECT_RESP: | 824 | case PNS_PEP_CONNECT_RESP: |
| 828 | err = pep_connresp_rcv(sk, skb); | 825 | pep_connresp_rcv(sk, skb); |
| 829 | break; | 826 | break; |
| 830 | #endif | 827 | #endif |
| 831 | 828 | ||
| @@ -842,11 +839,11 @@ static int pep_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 842 | case PNS_PEP_DISABLE_REQ: | 839 | case PNS_PEP_DISABLE_REQ: |
| 843 | /* invalid handle is not even allowed here! */ | 840 | /* invalid handle is not even allowed here! */ |
| 844 | default: | 841 | default: |
| 845 | err = NET_RX_DROP; | 842 | break; |
| 846 | } | 843 | } |
| 847 | drop: | 844 | drop: |
| 848 | kfree_skb(skb); | 845 | kfree_skb(skb); |
| 849 | return err; | 846 | return NET_RX_SUCCESS; |
| 850 | } | 847 | } |
| 851 | 848 | ||
| 852 | #ifndef CONFIG_PHONET_PIPECTRLR | 849 | #ifndef CONFIG_PHONET_PIPECTRLR |
