[ATM]: track and close listen sockets when sigd exits
authorChas Williams <chas@cmf.nrl.navy.mil>
Wed, 28 Sep 2005 23:35:01 +0000 (16:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Sep 2005 23:35:01 +0000 (16:35 -0700)
Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
net/atm/common.c
net/atm/signaling.c
net/atm/svc.c

index e93e838069e8794980c90dc80ef99bca31a2a4db..801a5813ec60ab54f7dbbecb313e80a53c57c03a 100644 (file)
@@ -178,8 +178,6 @@ static void vcc_destroy_socket(struct sock *sk)
                if (vcc->push)
                        vcc->push(vcc, NULL); /* atmarpd has no push */
 
-               vcc_remove_socket(sk);  /* no more receive */
-
                while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
                        atm_return(vcc,skb->truesize);
                        kfree_skb(skb);
@@ -188,6 +186,8 @@ static void vcc_destroy_socket(struct sock *sk)
                module_put(vcc->dev->ops->owner);
                atm_dev_put(vcc->dev);
        }
+
+       vcc_remove_socket(sk);
 }
 
 
index f7c449ac1800cffe9cb355806886f7d1d19e8950..e7211a7f382c5b35ea059bd36feabfa5f8a32cfd 100644 (file)
@@ -217,8 +217,9 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type,
 static void purge_vcc(struct atm_vcc *vcc)
 {
        if (sk_atm(vcc)->sk_family == PF_ATMSVC &&
-           !test_bit(ATM_VF_META,&vcc->flags)) {
-               set_bit(ATM_VF_RELEASED,&vcc->flags);
+           !test_bit(ATM_VF_META, &vcc->flags)) {
+               set_bit(ATM_VF_RELEASED, &vcc->flags);
+               clear_bit(ATM_VF_REGIS, &vcc->flags);
                vcc_release_async(vcc, -EUNATCH);
        }
 }
@@ -243,8 +244,7 @@ static void sigd_close(struct atm_vcc *vcc)
                sk_for_each(s, node, head) {
                        struct atm_vcc *vcc = atm_sk(s);
 
-                       if (vcc->dev)
-                               purge_vcc(vcc);
+                       purge_vcc(vcc);
                }
        }
        read_unlock(&vcc_sklist_lock);
index 08e46052a3e4a896714254fce4a6c46702152d7c..d7b266136bf64168d0ce7ac8cc5796801fc11f13 100644 (file)
@@ -302,6 +302,7 @@ static int svc_listen(struct socket *sock,int backlog)
                error = -EINVAL;
                goto out;
        }
+       vcc_insert_socket(sk);
        set_bit(ATM_VF_WAITING, &vcc->flags);
        prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
        sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local);