• Johan Hedberg's avatar
    Bluetooth: Fix waiting for EIR update when setting local name · 13928971
    Johan Hedberg authored
    We shouldn't respond to the mgmt_set_local_name command until all
    related HCI commands have completed. This patch fixes the issue by
    running the local name HCI command and the EIR update in the same
    asynchronous request, and returning the mgmt command complete through
    the complete callback of the request.
    
    The downside of this is that we must set hdev->dev_name before the local
    name HCI command has completed since otherwise the generated EIR
    command doesn't contain the new name. This means that we can no-longer
    reliably detect when the name has really changed and when not. Luckily
    this only affects scenarios where the mgmt interface is *not* used (e.g.
    hciconfig) so redundant mgmt_ev_local_name_changed events in these cases
    are an acceptable drawback.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
    13928971
mgmt.c 92.9 KB