Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: mgmt: Fix using hci_conn_abort

This fixes using hci_conn_abort instead of using hci_conn_abort_sync.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

+38 -5
+2
include/net/bluetooth/hci_sync.h
··· 105 105 106 106 struct hci_conn; 107 107 108 + int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason); 109 + 108 110 int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn);
+1 -2
net/bluetooth/hci_sync.c
··· 4489 4489 sizeof(cp), &cp, HCI_CMD_TIMEOUT); 4490 4490 } 4491 4491 4492 - static int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, 4493 - u8 reason) 4492 + int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason) 4494 4493 { 4495 4494 int err; 4496 4495
+35 -3
net/bluetooth/mgmt.c
··· 2528 2528 skip_sk); 2529 2529 } 2530 2530 2531 + static void unpair_device_complete(struct hci_dev *hdev, void *data, int err) 2532 + { 2533 + struct mgmt_pending_cmd *cmd = data; 2534 + struct mgmt_cp_unpair_device *cp = cmd->param; 2535 + 2536 + if (!err) 2537 + device_unpaired(hdev, &cp->addr.bdaddr, cp->addr.type, cmd->sk); 2538 + 2539 + cmd->cmd_complete(cmd, err); 2540 + mgmt_pending_free(cmd); 2541 + } 2542 + 2543 + static int unpair_device_sync(struct hci_dev *hdev, void *data) 2544 + { 2545 + struct mgmt_pending_cmd *cmd = data; 2546 + struct mgmt_cp_unpair_device *cp = cmd->param; 2547 + struct hci_conn *conn; 2548 + 2549 + if (cp->addr.type == BDADDR_BREDR) 2550 + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, 2551 + &cp->addr.bdaddr); 2552 + else 2553 + conn = hci_conn_hash_lookup_le(hdev, &cp->addr.bdaddr, 2554 + le_addr_type(cp->addr.type)); 2555 + 2556 + if (!conn) 2557 + return 0; 2558 + 2559 + return hci_abort_conn_sync(hdev, conn, HCI_ERROR_REMOTE_USER_TERM); 2560 + } 2561 + 2531 2562 static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, 2532 2563 u16 len) 2533 2564 { ··· 2669 2638 goto unlock; 2670 2639 } 2671 2640 2672 - cmd = mgmt_pending_add(sk, MGMT_OP_UNPAIR_DEVICE, hdev, cp, 2641 + cmd = mgmt_pending_new(sk, MGMT_OP_UNPAIR_DEVICE, hdev, cp, 2673 2642 sizeof(*cp)); 2674 2643 if (!cmd) { 2675 2644 err = -ENOMEM; ··· 2678 2647 2679 2648 cmd->cmd_complete = addr_cmd_complete; 2680 2649 2681 - err = hci_abort_conn(conn, HCI_ERROR_REMOTE_USER_TERM); 2650 + err = hci_cmd_sync_queue(hdev, unpair_device_sync, cmd, 2651 + unpair_device_complete); 2682 2652 if (err < 0) 2683 - mgmt_pending_remove(cmd); 2653 + mgmt_pending_free(cmd); 2684 2654 2685 2655 unlock: 2686 2656 hci_dev_unlock(hdev);