Bluetooth: Fix lockdep warning with skb list lock
authorGustavo F. Padovan <padovan@profusion.mobi>
Fri, 1 Apr 2011 18:13:36 +0000 (15:13 -0300)
committerGustavo F. Padovan <padovan@profusion.mobi>
Thu, 7 Apr 2011 21:06:28 +0000 (18:06 -0300)
This is a regression acctually, caused by the first patch series for
creating a formal strcut l2cap_chan.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
net/bluetooth/l2cap_core.c

index d3b5d6489a80fd591c19de859d29fb3884b0058b..7264119b64a65265350c8a1f5d7e6401cf648cce 100644 (file)
@@ -236,6 +236,10 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
        } else
                sk->sk_state_change(sk);
 
+       if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE &&
+                       l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE))
+               goto free;
+
        skb_queue_purge(TX_QUEUE(sk));
 
        if (l2cap_pi(sk)->mode == L2CAP_MODE_ERTM) {
@@ -254,6 +258,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
                }
        }
 
+free:
        kfree(chan);
 }