Skip to content

Commit

Permalink
Bluetooth: ISO: Fix invalid context error
Browse files Browse the repository at this point in the history
This moves the hci_le_terminate_big_sync call from rx_work
to cmd_sync_work, to avoid calling sleeping function from
an invalid context.

Reported-by: syzbot+c715e1bd8dfbcb1ab176@syzkaller.appspotmail.com
Fixes: a0bfde1 ("Bluetooth: ISO: Add support for connecting multiple BISes")
Signed-off-by: Iulia Tanasescu <iulia.tanasescu@nxp.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
Iulia Tanasescu authored and Luiz Augusto von Dentz committed Oct 11, 2023
1 parent 92d4abd commit acab8ff
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -7021,6 +7021,14 @@ static void hci_le_cis_req_evt(struct hci_dev *hdev, void *data,
hci_dev_unlock(hdev);
}

static int hci_iso_term_big_sync(struct hci_dev *hdev, void *data)
{
u8 handle = PTR_UINT(data);

return hci_le_terminate_big_sync(hdev, handle,
HCI_ERROR_LOCAL_HOST_TERM);
}

static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data,
struct sk_buff *skb)
{
Expand Down Expand Up @@ -7065,16 +7073,17 @@ static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data,
rcu_read_lock();
}

rcu_read_unlock();

if (!ev->status && !i)
/* If no BISes have been connected for the BIG,
* terminate. This is in case all bound connections
* have been closed before the BIG creation
* has completed.
*/
hci_le_terminate_big_sync(hdev, ev->handle,
HCI_ERROR_LOCAL_HOST_TERM);
hci_cmd_sync_queue(hdev, hci_iso_term_big_sync,
UINT_PTR(ev->handle), NULL);

rcu_read_unlock();
hci_dev_unlock(hdev);
}

Expand Down

0 comments on commit acab8ff

Please sign in to comment.