aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/phonet/pep.h5
-rw-r--r--net/phonet/pep.c27
2 files changed, 31 insertions, 1 deletions
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index 35672b1cf44a..37f23dc05de8 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -77,6 +77,11 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
77#define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4) 77#define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4)
78 78
79enum { 79enum {
80 PNS_PIPE_CREATE_REQ = 0x00,
81 PNS_PIPE_CREATE_RESP,
82 PNS_PIPE_REMOVE_REQ,
83 PNS_PIPE_REMOVE_RESP,
84
80 PNS_PIPE_DATA = 0x20, 85 PNS_PIPE_DATA = 0x20,
81 PNS_PIPE_ALIGNED_DATA, 86 PNS_PIPE_ALIGNED_DATA,
82 87
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 04e34196c9de..d0e7eb24c8b9 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -620,6 +620,28 @@ drop:
620 return err; 620 return err;
621} 621}
622 622
623static int pipe_do_remove(struct sock *sk)
624{
625 struct pep_sock *pn = pep_sk(sk);
626 struct pnpipehdr *ph;
627 struct sk_buff *skb;
628
629 skb = alloc_skb(MAX_PNPIPE_HEADER, GFP_KERNEL);
630 if (!skb)
631 return -ENOMEM;
632
633 skb_reserve(skb, MAX_PNPIPE_HEADER);
634 __skb_push(skb, sizeof(*ph));
635 skb_reset_transport_header(skb);
636 ph = pnp_hdr(skb);
637 ph->utid = 0;
638 ph->message_id = PNS_PIPE_REMOVE_REQ;
639 ph->pipe_handle = pn->pipe_handle;
640 ph->data[0] = PAD;
641
642 return pn_skb_send(sk, skb, &pipe_srv);
643}
644
623/* associated socket ceases to exist */ 645/* associated socket ceases to exist */
624static void pep_sock_close(struct sock *sk, long timeout) 646static void pep_sock_close(struct sock *sk, long timeout)
625{ 647{
@@ -638,7 +660,10 @@ static void pep_sock_close(struct sock *sk, long timeout)
638 sk_for_each_safe(sknode, p, n, &pn->ackq) 660 sk_for_each_safe(sknode, p, n, &pn->ackq)
639 sk_del_node_init(sknode); 661 sk_del_node_init(sknode);
640 sk->sk_state = TCP_CLOSE; 662 sk->sk_state = TCP_CLOSE;
641 } 663 } else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED))
664 /* Forcefully remove dangling Phonet pipe */
665 pipe_do_remove(sk);
666
642 ifindex = pn->ifindex; 667 ifindex = pn->ifindex;
643 pn->ifindex = 0; 668 pn->ifindex = 0;
644 release_sock(sk); 669 release_sock(sk);