Hi Andrei, On Wed, Feb 15, 2012 at 7:24 AM, Emeltchenko Andrei <Andrei.Emeltchenko.news@xxxxxxxxx> wrote: > Hi Ulisses, > > On Wed, Feb 15, 2012 at 10:16:53AM +0200, Emeltchenko Andrei wrote: >> On Tue, Feb 14, 2012 at 03:23:54PM -0200, Ulisses Furquim wrote: >> > On Tue, Feb 14, 2012 at 11:21 AM, Emeltchenko Andrei >> > <Andrei.Emeltchenko.news@xxxxxxxxx> wrote: >> > > Hi Ulisses, >> > > >> > > On Mon, Feb 13, 2012 at 10:06:10PM -0300, Ulisses Furquim wrote: >> > > ... >> > >> Yes, I do think they belong together. And please, check l2cap_sock.c >> > >> where l2cap_chan_close() seems to be called without locking >> > >> conn->chan_lock in l2cap_sock_shutdown(). >> > > >> > > In that context we do not always have l2cap_conn so maybe we return >> > > chan list lock to chan_del or invent unlocked chan_del / chan_close? >> > >> > We don't have l2cap_conn? So are we already on conn->chan_l list or >> > not? Maybe it's better to check that instead of changing everything >> > now. > > Maybe this check? > > if (!sk->sk_shutdown) { > + struct l2cap_conn *conn = chan->conn; > + > if (chan->mode == L2CAP_MODE_ERTM) > err = __l2cap_wait_ack(sk); > > sk->sk_shutdown = SHUTDOWN_MASK; > release_sock(sk); > + > + if (conn) > + mutex_lock(&conn->chan_lock); > l2cap_chan_close(chan, 0); > + if (conn) > + mutex_unlock(&conn->chan_lock); > + > lock_sock(sk); > > if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) > err = bt_sock_wait_state(sk, BT_CLOSED, > sk->sk_lingertime); > > If it does not look too hackish... l2cap_chan_del() is already doing the exact same test for conn to remove it from conn->chan_l or not. Maybe add a comment to make it more clear? Regards, -- Ulisses Furquim ProFUSION embedded systems http://profusion.mobi Mobile: +55 19 9250 0942 Skype: ulissesffs -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html