]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Bluetooth: mgmt: Fix updating EIR when updating the name
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 22 Feb 2012 16:17:32 +0000 (18:17 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 23 Feb 2012 11:06:59 +0000 (13:06 +0200)
Whenever we update the local device name the EIR data also needs to be
updated to reflect this. The update_eir() function in mgmt.c depends on
hdev->dev_name to be up to date so the patch also makes sure that the
mgmt function is called from hci_event.c after the update has happened.

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

index 498b71a0579acddb6523aa0b2a1623595b3397e1..e44e3fd68628faa16a8743d35e1d874f1e588fa1 100644 (file)
@@ -209,12 +209,12 @@ static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
 
        hci_dev_lock(hdev);
 
-       if (test_bit(HCI_MGMT, &hdev->dev_flags))
-               mgmt_set_local_name_complete(hdev, sent, status);
-
        if (status == 0)
                memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH);
 
+       if (test_bit(HCI_MGMT, &hdev->dev_flags))
+               mgmt_set_local_name_complete(hdev, sent, status);
+
        hci_dev_unlock(hdev);
 }
 
index 8bc6a7a4873211d34bcdcf56634af0f549c25550..d756644163bcd3d5c63ec928966f2cf7b92e10d9 100644 (file)
@@ -3561,6 +3561,7 @@ int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
 send_event:
        err = mgmt_event(MGMT_EV_LOCAL_NAME_CHANGED, hdev, &ev, sizeof(ev),
                                                        cmd ? cmd->sk : NULL);
+       update_eir(hdev);
 
 failed:
        if (cmd)