Skip to content

Commit 679d2b6

Browse files
Johan Hedbergholtmann
authored andcommitted
Bluetooth: Fix remove_device behavior for explicit connects
Devices undergoing an explicit connect should not have their conn_params struct removed by the mgmt Remove Device command. This patch fixes the necessary checks in the command handler to correct the behavior. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 49c5092 commit 679d2b6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/bluetooth/mgmt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6386,7 +6386,8 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
63866386
goto unlock;
63876387
}
63886388

6389-
if (params->auto_connect == HCI_AUTO_CONN_DISABLED) {
6389+
if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||
6390+
params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
63906391
err = cmd->cmd_complete(cmd,
63916392
MGMT_STATUS_INVALID_PARAMS);
63926393
mgmt_pending_remove(cmd);
@@ -6422,6 +6423,10 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
64226423
if (p->auto_connect == HCI_AUTO_CONN_DISABLED)
64236424
continue;
64246425
device_removed(sk, hdev, &p->addr, p->addr_type);
6426+
if (p->explicit_connect) {
6427+
p->auto_connect = HCI_AUTO_CONN_EXPLICIT;
6428+
continue;
6429+
}
64256430
list_del(&p->action);
64266431
list_del(&p->list);
64276432
kfree(p);

0 commit comments

Comments
 (0)