diff options
author | Pauli Virtanen <pav@iki.fi> | 2023-07-10 19:48:19 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-07-20 11:26:56 -0700 |
commit | 3dcaa192ac2159193bc6ab57bc5369dcb84edd8e (patch) | |
tree | c77dd61ac6919d4ab5d45930bbd569bf7b3768a6 /drivers | |
parent | b4066eb04bb67e7ff66e5aaab0db4a753f37eaad (diff) | |
download | lwn-3dcaa192ac2159193bc6ab57bc5369dcb84edd8e.tar.gz lwn-3dcaa192ac2159193bc6ab57bc5369dcb84edd8e.zip |
Bluetooth: SCO: fix sco_conn related locking and validity issues
Operations that check/update sk_state and access conn should hold
lock_sock, otherwise they can race.
The order of taking locks is hci_dev_lock > lock_sock > sco_conn_lock,
which is how it is in connect/disconnect_cfm -> sco_conn_del ->
sco_chan_del.
Fix locking in sco_connect to take lock_sock around updating sk_state
and conn.
sco_conn_del must not occur during sco_connect, as it frees the
sco_conn. Hold hdev->lock longer to prevent that.
sco_conn_add shall return sco_conn with valid hcon. Make it so also when
reusing an old SCO connection waiting for disconnect timeout (see
__sco_sock_close where conn->hcon is set to NULL).
This should not reintroduce the issue fixed in the earlier
commit 9a8ec9e8ebb5 ("Bluetooth: SCO: Fix possible circular locking
dependency on sco_connect_cfm"), the relevant fix of releasing lock_sock
in sco_sock_connect before acquiring hdev->lock is retained.
These changes mirror similar fixes earlier in ISO sockets.
Fixes: 9a8ec9e8ebb5 ("Bluetooth: SCO: Fix possible circular locking dependency on sco_connect_cfm")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions