]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Add missing error handling for Set Connectable
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 14 Oct 2013 13:20:05 +0000 (16:20 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Oct 2013 13:48:08 +0000 (06:48 -0700)
If the HCI commands related to the Set Connectable command fail we will
get a non-zero status in the request completion callback. In such a case
we must respond with the appropriate command status message to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index 8dcea7726f8d68ae1de5a1dc7b145ef7bbe1047f..a5c015cadd552a338ada19bc59b3007ce8def012 100644 (file)
@@ -1086,6 +1086,12 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status)
        if (!cmd)
                goto unlock;
 
+       if (status) {
+               u8 mgmt_err = mgmt_status(status);
+               cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
+               goto remove_cmd;
+       }
+
        cp = cmd->param;
        if (cp->val)
                changed = !test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
@@ -1097,6 +1103,7 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status)
        if (changed)
                new_settings(hdev, cmd->sk);
 
+remove_cmd:
        mgmt_pending_remove(cmd);
 
 unlock: