Bluetooth: Fix crash when setting a LE socket to ready
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Sat, 18 Jun 2011 01:46:26 +0000 (22:46 -0300)
committerGustavo F. Padovan <padovan@profusion.mobi>
Mon, 20 Jun 2011 19:32:04 +0000 (16:32 -0300)
We should not try to do any other type of configuration for
LE links when they become ready.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
net/bluetooth/l2cap_core.c

index 25f31f4c7d0824b7a205212616b2014232b134fd..b8c1df2035ec6aa51543e17f04edbfbbcabe535a 100644 (file)
@@ -918,11 +918,11 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
 
                bh_lock_sock(sk);
 
-               if (conn->hcon->type == LE_LINK)
+               if (conn->hcon->type == LE_LINK) {
                        if (smp_conn_security(conn, chan->sec_level))
                                l2cap_chan_ready(sk);
 
-               if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
+               } else if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
                        __clear_chan_timer(chan);
                        l2cap_state_change(chan, BT_CONNECTED);
                        sk->sk_state_change(sk);