hci_conn_del() caller must hold hdev->lock, check the conn was not concurrently deleted, and usually inform socket the conn is going to be deleted. Use hci_abort_conn_sync() instead of calling hci_conn_del() without locks etc.
Unified · Split
| @@ -6757,7 +6757,9 @@ static int hci_le_create_conn_sync(struct hci_dev *hdev, void *data) · 6756 unmodified lines | |||
| 6757 | if (hci_dev_test_flag(hdev, HCI_LE_SCAN) && | 6757 | if (hci_dev_test_flag(hdev, HCI_LE_SCAN) && |
| 6758 | hdev->le_scan_type == LE_SCAN_ACTIVE && | 6758 | hdev->le_scan_type == LE_SCAN_ACTIVE && |
| 6759 | !hci_dev_test_flag(hdev, HCI_LE_SIMULTANEOUS_ROLES)) { | 6759 | !hci_dev_test_flag(hdev, HCI_LE_SIMULTANEOUS_ROLES)) { |
| 6760 | hci_conn_del(conn); | 6760 | conn->state = BT_OPEN; |
| 6761 | hci_abort_conn_sync(hdev, conn, | ||
| 6762 | HCI_ERROR_REJ_LIMITED_RESOURCES); | ||
| 6761 | hci_conn_put(conn); | 6763 | hci_conn_put(conn); |
| 6762 | return -EBUSY; | 6764 | return -EBUSY; |
| 6763 | } | 6765 | } |