diff options
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index c64e5db7f596..f1257ee5afbc 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1185,9 +1185,10 @@ static int disconnect(struct sock *sk, u16 index, void *data, u16 len) | |||
1185 | goto failed; | 1185 | goto failed; |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); | 1188 | if (cp->addr.type == MGMT_ADDR_BREDR) |
1189 | if (!conn) | 1189 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr); |
1190 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->bdaddr); | 1190 | else |
1191 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); | ||
1191 | 1192 | ||
1192 | if (!conn) { | 1193 | if (!conn) { |
1193 | err = cmd_status(sk, index, MGMT_OP_DISCONNECT, | 1194 | err = cmd_status(sk, index, MGMT_OP_DISCONNECT, |
@@ -2619,7 +2620,8 @@ static void disconnect_rsp(struct pending_cmd *cmd, void *data) | |||
2619 | struct sock **sk = data; | 2620 | struct sock **sk = data; |
2620 | struct mgmt_rp_disconnect rp; | 2621 | struct mgmt_rp_disconnect rp; |
2621 | 2622 | ||
2622 | bacpy(&rp.bdaddr, &cp->bdaddr); | 2623 | bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr); |
2624 | rp.addr.type = cp->addr.type; | ||
2623 | rp.status = 0; | 2625 | rp.status = 0; |
2624 | 2626 | ||
2625 | cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp)); | 2627 | cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp)); |
@@ -2672,27 +2674,23 @@ int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, | |||
2672 | return err; | 2674 | return err; |
2673 | } | 2675 | } |
2674 | 2676 | ||
2675 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status) | 2677 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, |
2678 | u8 link_type, u8 addr_type, u8 status) | ||
2676 | { | 2679 | { |
2680 | struct mgmt_rp_disconnect rp; | ||
2677 | struct pending_cmd *cmd; | 2681 | struct pending_cmd *cmd; |
2678 | u8 mgmt_err = mgmt_status(status); | ||
2679 | int err; | 2682 | int err; |
2680 | 2683 | ||
2681 | cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, hdev); | 2684 | cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, hdev); |
2682 | if (!cmd) | 2685 | if (!cmd) |
2683 | return -ENOENT; | 2686 | return -ENOENT; |
2684 | 2687 | ||
2685 | if (bdaddr) { | 2688 | bacpy(&rp.addr.bdaddr, bdaddr); |
2686 | struct mgmt_rp_disconnect rp; | 2689 | rp.addr.type = link_to_mgmt(link_type, addr_type); |
2687 | 2690 | rp.status = mgmt_status(status); | |
2688 | bacpy(&rp.bdaddr, bdaddr); | ||
2689 | rp.status = status; | ||
2690 | 2691 | ||
2691 | err = cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, | 2692 | err = cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, |
2692 | &rp, sizeof(rp)); | 2693 | &rp, sizeof(rp)); |
2693 | } else | ||
2694 | err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT, | ||
2695 | mgmt_err); | ||
2696 | 2694 | ||
2697 | mgmt_pending_remove(cmd); | 2695 | mgmt_pending_remove(cmd); |
2698 | 2696 | ||