mISDN: Correct busy device detection
authorAndreas Eversberg <andreas@eversberg.eu>
Sun, 14 Sep 2008 12:42:18 +0000 (14:42 +0200)
committerKarsten Keil <kkeil@suse.de>
Fri, 9 Jan 2009 21:44:27 +0000 (22:44 +0100)
Correct busy device detection.
This fix belongs to last commit.

Signed-off-by: Andreas Eversberg <andreas@eversberg.eu>
Signed-off-by: Karsten Keil <kkeil@suse.de>
drivers/isdn/mISDN/socket.c
drivers/isdn/mISDN/stack.c

index 916569ca156d4daf1b699fef711599f7b30b1b77..508945d1b9c1a4b3ac18a31471179f13097a8cc3 100644 (file)
@@ -483,22 +483,24 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
                goto done;
        }
 
-       read_lock_bh(&data_sockets.lock);
-       sk_for_each(csk, node, &data_sockets.head) {
-               if (sk == csk)
-                       continue;
-               if (_pms(csk)->dev != _pms(sk)->dev)
-                       continue;
-               if (csk->sk_protocol >= ISDN_P_B_START)
-                       continue;
-               if (IS_ISDN_P_TE(csk->sk_protocol)
-                               == IS_ISDN_P_TE(sk->sk_protocol))
-                       continue;
+       if (sk->sk_protocol < ISDN_P_B_START) {
+               read_lock_bh(&data_sockets.lock);
+               sk_for_each(csk, node, &data_sockets.head) {
+                       if (sk == csk)
+                               continue;
+                       if (_pms(csk)->dev != _pms(sk)->dev)
+                               continue;
+                       if (csk->sk_protocol >= ISDN_P_B_START)
+                               continue;
+                       if (IS_ISDN_P_TE(csk->sk_protocol)
+                                       == IS_ISDN_P_TE(sk->sk_protocol))
+                               continue;
+                       read_unlock_bh(&data_sockets.lock);
+                       err = -EBUSY;
+                       goto done;
+               }
                read_unlock_bh(&data_sockets.lock);
-               err = -EBUSY;
-               goto done;
        }
-       read_unlock_bh(&data_sockets.lock);
 
        _pms(sk)->ch.send = mISDN_send;
        _pms(sk)->ch.ctrl = mISDN_ctrl;
index 63afa8cf9e07f1e3b408d3665d9e814c47bc7c13..e2f45019ebf0be504bdcd68538cd47f51109c588 100644 (file)
@@ -446,7 +446,8 @@ connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch,
                rq.protocol = protocol;
                rq.adr.channel = adr->channel;
                err = dev->D.ctrl(&dev->D, OPEN_CHANNEL, &rq);
-               printk(KERN_DEBUG "%s: ret 1 %d\n", __func__, err);
+               printk(KERN_DEBUG "%s: ret %d (dev %d)\n", __func__, err,
+                       dev->id);
                if (err)
                        return err;
                write_lock_bh(&dev->D.st->l1sock.lock);