mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 10:02:02 +02:00
Bluetooth: ISO: balance the parent hold in hci_bind_bis()
hci_conn_link() takes a lifetime reference to its parent with
hci_conn_get(), but only takes an operational hold on the child.
hci_conn_unlink() later balances both a hold and a reference on the
parent.
The SCO and CIS paths pass a parent acquired from a connect helper, so
it already has a hold. For an additional BIS, hci_bind_bis() obtains the
parent from hci_conn_hash_lookup_big(), which returns a bare pointer.
Unlinking the child then drops the parent's existing hold and can
schedule it for disconnection while its socket is still using it.
Take a hold on the parent before linking it and drop that hold if linking
fails. A successful link transfers the hold to hci_conn_unlink().
Fixes: fa224d0c09 ("Bluetooth: ISO: Reassociate a socket with an active BIS")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
b0a6cf99af
commit
4c94557dd0
|
|
@ -2375,10 +2375,13 @@ struct hci_conn *hci_bind_bis(struct hci_dev *hdev, bdaddr_t *dst, __u8 sid,
|
|||
parent = hci_conn_hash_lookup_big(hdev,
|
||||
conn->iso_qos.bcast.big);
|
||||
if (parent && parent != conn) {
|
||||
hci_conn_hold(parent);
|
||||
link = hci_conn_link(parent, conn);
|
||||
hci_conn_drop(conn);
|
||||
if (!link)
|
||||
if (!link) {
|
||||
hci_conn_drop(parent);
|
||||
return ERR_PTR(-ENOLINK);
|
||||
}
|
||||
}
|
||||
|
||||
return conn;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user