Skip to content

Commit a2639a7

Browse files
pvVudentz
authored andcommitted
Bluetooth: hci_conn: fix potential UAF in set_cig_params_sync
hci_conn lookup and field access must be covered by hdev lock in set_cig_params_sync, otherwise it's possible it is freed concurrently. Take hdev lock to prevent hci_conn from being deleted or modified concurrently. Just RCU lock is not suitable here, as we also want to avoid "tearing" in the configuration. Fixes: a091289 ("Bluetooth: hci_conn: Fix hci_le_set_cig_params") Signed-off-by: Pauli Virtanen <pav@iki.fi> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent b8dbe96 commit a2639a7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

net/bluetooth/hci_conn.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,9 +1843,13 @@ static int set_cig_params_sync(struct hci_dev *hdev, void *data)
18431843
u8 aux_num_cis = 0;
18441844
u8 cis_id;
18451845

1846+
hci_dev_lock(hdev);
1847+
18461848
conn = hci_conn_hash_lookup_cig(hdev, cig_id);
1847-
if (!conn)
1849+
if (!conn) {
1850+
hci_dev_unlock(hdev);
18481851
return 0;
1852+
}
18491853

18501854
qos = &conn->iso_qos;
18511855
pdu->cig_id = cig_id;
@@ -1884,6 +1888,8 @@ static int set_cig_params_sync(struct hci_dev *hdev, void *data)
18841888
}
18851889
pdu->num_cis = aux_num_cis;
18861890

1891+
hci_dev_unlock(hdev);
1892+
18871893
if (!pdu->num_cis)
18881894
return 0;
18891895

0 commit comments

Comments
 (0)