In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: L2CAP: fix race condition in l2cap_sock_shutdown()
l2cap_sock_shutdown() has the race condition
[Task 1] [Task 2]
l2cap_sock_shutdown l2cap_sock_connect
l2cap_chan_lock l2cap_chan_connect
conn = ... /* == NULL*/
l2cap_chan_unlock ------------> l2cap_chan_lock
if (conn) /* false */
__l2cap_chan_add(conn, chan)
l2cap_chan_lock <-------------- l2cap_chan_unlock
l2cap_chan_close /* chan->conn->lock not held! */
conn->lock protects conn->chan_l and is not properly held here.
Use the l2cap_chan_close_unlocked() helper that ensures conn->lock is
held for l2cap_chan_close().