Skip to content
Permalink
Manish-Mandlik…
Switch branches/tags

Commits on Sep 22, 2021

  1. bluetooth: Fix Advertisement Monitor Suspend/Resume

    During system suspend, advertisement monitoring is disabled by setting
    the HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable to False. This
    disables the monitoring during suspend, however, if the controller is
    monitoring a device, it sends HCI_VS_MSFT_LE_Monitor_Device_Event to
    indicate that the monitoring has been stopped for that particular
    device. This event may occur after suspend depending on the
    low_threshold_timeout and peer device advertisement frequency, which
    causes early wake up.
    
    Right way to disable the monitoring for suspend is by removing all the
    monitors before suspend and re-monitor after resume to ensure no events
    are received during suspend. This patch fixes this suspend/resume issue.
    
    Following tests are performed:
    - Add monitors before suspend and make sure DeviceFound gets triggered
    - Suspend the system and verify that all monitors are removed by kernel
      but not Released by bluetoothd
    - Wake up and verify that all monitors are added again and DeviceFound
      gets triggered
    
    Signed-off-by: Manish Mandlik <mmandlik@google.com>
    Reviewed-by: Archie Pusaka <apusaka@google.com>
    Reviewed-by: Miao-chen Chou <mcchou@google.com>
    liveusr authored and intel-lab-lkp committed Sep 22, 2021

Commits on Sep 21, 2021

  1. Bluetooth: btusb: Add gpio reset way for qca btsoc in cmd_timeout

    if platform provide gpio connect to BT_EN reset pin of qca btsoc chip,
    we can do hardware reset instead of usb port reset.
    
    Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    tjiang123 authored and holtmann committed Sep 21, 2021
  2. Bluetooth: SCO: Fix sco_send_frame returning skb->len

    The skb in modified by hci_send_sco which pushes SCO headers thus
    changing skb->len causing sco_sock_sendmsg to fail.
    
    Fixes: 0771cbb ("Bluetooth: SCO: Replace use of memcpy_from_msg with bt_skb_sendmsg")
    Tested-by: Tedd Ho-Jeong An <tedd.an@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 21, 2021
  3. Bluetooth: Fix passing NULL to PTR_ERR

    Passing NULL to PTR_ERR will result in 0 (success), also since the likes of
    bt_skb_sendmsg does never return NULL it is safe to replace the instances of
    IS_ERR_OR_NULL with IS_ERR when checking its return.
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Tested-by: Tedd Ho-Jeong An <tedd.an@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 21, 2021
  4. Bluetooth: hci_sock: Add support for BT_{SND,RCV}BUF

    This adds support for BT_{SND,RCV}BUF so userspace can set MTU based on
    the channel usage.
    
    Fixes: bluez/bluez#201
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 21, 2021
  5. Bluetooth: eir: Move EIR/Adv Data functions to its own file

    This moves functions manipulating EIR/Adv Data to its own file so it
    can be reused by other files.
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 21, 2021

Commits on Sep 13, 2021

  1. Bluetooth: RFCOMM: Replace use of memcpy_from_msg with bt_skb_sendmmsg

    This makes use of bt_skb_sendmmsg instead using memcpy_from_msg which
    is not considered safe to be used when lock_sock is held.
    
    Also make rfcomm_dlc_send handle skb with fragments and queue them all
    atomically.
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 13, 2021
  2. Bluetooth: SCO: Replace use of memcpy_from_msg with bt_skb_sendmsg

    This makes use of bt_skb_sendmsg instead of allocating a different
    buffer to be used with memcpy_from_msg which cause one extra copy.
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 13, 2021
  3. Bluetooth: Add bt_skb_sendmmsg helper

    This works similarly to bt_skb_sendmsg but can split the msg into
    multiple skb fragments which is useful for stream sockets.
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 13, 2021
  4. Bluetooth: Add bt_skb_sendmsg helper

    bt_skb_sendmsg helps takes care of allocation the skb and copying the
    the contents of msg over to the skb while checking for possible errors
    so it should be safe to call it without holding lock_sock.
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Vudentz authored and holtmann committed Sep 13, 2021

Commits on Sep 10, 2021

  1. Bluetooth: hci_uart: fix GPF in h5_recv

    Syzbot hit general protection fault in h5_recv(). The problem was in
    missing NULL check.
    
    hu->serdev can be NULL and we cannot blindly pass &serdev->dev
    somewhere, since it can cause GPF.
    
    Fixes: d9dd833 ("Bluetooth: hci_h5: Add runtime suspend")
    Reported-and-tested-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com
    Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    pskrgag authored and holtmann committed Sep 10, 2021
  2. Bluetooth: btintel: Fix incorrect out of memory check

    Currently *ven_data is being assigned the return from a kmalloc call but
    the out-of-memory check is checking ven_data and not *ven_data. Fix this
    by adding the missing dereference * operator,
    
    Addresses-Coverity: ("Dereference null return")
    Fixes: 70dd978 ("Bluetooth: btintel: Define a callback to fetch codec config data")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Colin Ian King authored and holtmann committed Sep 10, 2021
  3. Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle

    This splits the msft_do_{open/close} to msft_do_{open/close} and
    msft_{register/unregister}. With this change it is possible to retain
    the MSFT extension info irrespective of controller power on/off state.
    This helps bluetoothd to report correct 'supported features' of the
    controller to the D-Bus clients event if the controller is off. It also
    re-reads the MSFT info upon every msft_do_open().
    
    The following test steps were performed.
    1. Boot the test device and verify the MSFT support debug log in syslog.
    2. Power off the controller and read the 'supported features', power on
       and read again.
    3. Restart the bluetoothd and verify the 'supported features' value.
    
    Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
    Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
    Reviewed-by: Archie Pusaka <apusaka@chromium.org>
    Reviewed-by: Alain Michaud <alainm@chromium.org>
    Signed-off-by: Manish Mandlik <mmandlik@google.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    mcchou-cr authored and holtmann committed Sep 10, 2021

Commits on Sep 7, 2021

  1. Bluetooth: hci_vhci: Add support for offload codecs over SCO

    Define the callbacks required to support offload codecs
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  2. Bluetooth: Allow usb to auto-suspend when SCO use non-HCI transport

    Currently usb tranport is not allowed to suspend when SCO over
    HCI tranport is active.
    
    This patch shall enable the usb tranport to suspend when SCO
    link use non-HCI transport.
    
    Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    chethantn authored and Vudentz committed Sep 7, 2021
  3. Bluetooth: Add offload feature under experimental flag

    Allow user level process to enable / disable codec offload
    feature through mgmt interface. By default offload codec feature
    is disabled.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  4. Bluetooth: Add support for msbc coding format

    In Enhanced_Setup_Synchronous_Command, add support for msbc
    coding format
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  5. Bluetooth: btintel: Define a callback to fetch codec config data

    Define callback function to get codec config data. In HFP offload
    usecase, controllers need to be set codec details before opening SCO.
    This callback function is used to fetch vendor specific codec config
    data.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  6. Bluetooth: Configure codec for HFP offload use case

    For HFP offload use case, codec needs to be configured
    before opening SCO connection. This patch sends
    HCI_CONFIGURE_DATA_PATH command to configure doec before
    opening SCO connection.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  7. Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection …

    …command
    
    < HCI Command: Enhanced Setup Synchronous Connection (0x01|0x003d) plen 59
            Handle: 256
            Transmit bandwidth: 8000
            Receive bandwidth: 8000
            Max latency: 13
            Packet type: 0x0380
              3-EV3 may not be used
              2-EV5 may not be used
              3-EV5 may not be used
            Retransmission effort: Optimize for link quality (0x02)
    > HCI Event: Command Status (0x0f) plen 4
          Enhanced Setup Synchronous Connection (0x01|0x003d) ncmd 1
            Status: Success (0x00)
    > HCI Event: Synchronous Connect Complete (0x2c) plen 17
            Status: Success (0x00)
            Handle: 257
            Address: CC:98:8B:92:04:FD (SONY Visual Products Inc.)
            Link type: eSCO (0x02)
            Transmission interval: 0x0c
            Retransmission window: 0x06
            RX packet length: 60
            TX packet length: 60
            Air mode: Transparent (0x03)
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  8. Bluetooth: Allow setting of codec for HFP offload use case

    This patch allows user space to set the codec that needs to
    be used for HFP offload use case. The codec details are cached and
    the controller is configured before opening the SCO connection.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  9. Bluetooth: btintel: Define callback to fetch data_path_id

    For Intel controllers supporting HFP offload usecase,
    define a callback function to fetch data_path_id
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  10. Bluetooth: Allow querying of supported offload codecs over SCO socket

    Add BT_CODEC option for getsockopt systemcall to get the details
    of offload codecs supported over SCO socket
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  11. Bluetooth: btintel: Read supported offload use cases

    Read offload use cases supported by controller.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  12. Bluetooth: Add support for Read Local Supported Codecs V2

    Use V2 version of read local supported command is controller
    supports
    
    snoop:
    > HCI Event: Command Complete (0x0e) plen 20
          Read Local Supported Codecs V2 (0x04|0x000d) ncmd 1
            Status: Success (0x00)
            Number of supported codecs: 7
              Codec: u-law log (0x00)
              Logical Transport Type: 0x02
                Codec supported over BR/EDR SCO and eSCO
              Codec: A-law log (0x01)
              Logical Transport Type: 0x02
                Codec supported over BR/EDR SCO and eSCO
              Codec: CVSD (0x02)
              Logical Transport Type: 0x02
                Codec supported over BR/EDR SCO and eSCO
              Codec: Transparent (0x03)
              Logical Transport Type: 0x02
                Codec supported over BR/EDR SCO and eSCO
              Codec: Linear PCM (0x04)
              Logical Transport Type: 0x02
                Codec supported over BR/EDR SCO and eSCO
              Codec: Reserved (0x08)
              Logical Transport Type: 0x03
                Codec supported over BR/EDR ACL
                Codec supported over BR/EDR SCO and eSCO
              Codec: mSBC (0x05)
              Logical Transport Type: 0x03
                Codec supported over BR/EDR ACL
                Codec supported over BR/EDR SCO and eSCO
            Number of vendor codecs: 0
    ......
    < HCI Command: Read Local Suppor.. (0x04|0x000e) plen 7
            Codec: mSBC (0x05)
            Logical Transport Type: 0x00
            Direction: Input (Host to Controller) (0x00)
    > HCI Event: Command Complete (0x0e) plen 12
          Read Local Supported Codec Capabilities (0x04|0x000e) ncmd 1
            Status: Success (0x00)
            Number of codec capabilities: 1
             Capabilities #0:
            00 00 11 15 02 33
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Signed-off-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021
  13. Bluetooth: Enumerate local supported codec and cache details

    Move reading of supported local codecs into a separate init function,
    query codecs capabilities and cache the data
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
    Signed-off-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    kirankrishnappa-intel authored and Vudentz committed Sep 7, 2021

Commits on Sep 3, 2021

  1. Bluetooth: fix init and cleanup of sco_conn.timeout_work

    Before freeing struct sco_conn, all delayed timeout work should be
    cancelled. Otherwise, sco_sock_timeout could potentially use the
    sco_conn after it has been freed.
    
    Additionally, sco_conn.timeout_work should be initialized when the
    connection is allocated, not when the channel is added. This is
    because an sco_conn can create channels with multiple sockets over its
    lifetime, which happens if sockets are released but the connection
    isn't deleted.
    
    Fixes: ba316be ("Bluetooth: schedule SCO timeouts with delayed_work")
    Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    desmondcheongzx authored and Vudentz committed Sep 3, 2021
  2. Bluetooth: call sock_hold earlier in sco_conn_del

    In sco_conn_del, conn->sk is read while holding on to the
    sco_conn.lock to avoid races with a socket that could be released
    concurrently.
    
    However, in between unlocking sco_conn.lock and calling sock_hold,
    it's possible for the socket to be freed, which would cause a
    use-after-free write when sock_hold is finally called.
    
    To fix this, the reference count of the socket should be increased
    while the sco_conn.lock is still held.
    
    Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    desmondcheongzx authored and Vudentz committed Sep 3, 2021

Commits on Sep 2, 2021

  1. Bluetooth: btusb: Add support for IMC Networks Mediatek Chip(MT7921)

    Add support for another IMC Networks Mediatek Chip(MT7921)
    
    * /sys/kernel/debug/usb/devices
    T:  Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=13d3 ProdID=3564 Rev= 1.00
    S:  Manufacturer=MediaTek Inc.
    S:  Product=Wireless_Device
    S:  SerialNumber=000000000
    C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
    A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
    E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
    I:  If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
    E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
    
    Signed-off-by: mark-yw.chen <mark-yw.chen@mediatek.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    mark-yw.chen authored and holtmann committed Sep 2, 2021

Commits on Sep 1, 2021

  1. Bluetooth: btusb: Add the new support ID for Realtek RTL8852A

    Add the new support ID(0x04c5, 0x165c) to usb_device_id table for
    Realtek RTL8852A.
    
    The device info from /sys/kernel/debug/usb/devices as below.
    
    T:  Bus=01 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
    D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=04c5 ProdID=165c Rev= 0.00
    S:  Manufacturer=Realtek
    S:  Product=Bluetooth Radio
    S:  SerialNumber=00e04c000001
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    
    Signed-off-by: Max Chou <max.chou@realtek.com>
    Reviewed-by: Christian Bauer <christian.bauer1.external@fujitsu.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    rtkbt-max authored and holtmann committed Sep 1, 2021
  2. Bluetooth: btusb: Add protocol for MediaTek bluetooth devices(MT7922)

    The information in /sys/kernel/debug/usb/devices about the MT7922U
    Bluetooth device is listed as the below.
    
    T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 18 Spd=480 MxCh= 0
    D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0e8d ProdID=7922 Rev= 1.00
    S: Manufacturer=MediaTek Inc.
    S: Product=Wireless_Device
    S: SerialNumber=000000000
    C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
    A: FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us
    E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
    E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us
    E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us
    I: If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
    E: Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us
    E: Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
    
    Signed-off-by: mark-yw.chen <mark-yw.chen@mediatek.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    mark-yw.chen authored and holtmann committed Sep 1, 2021
  3. Bluetooth: btusb: Support public address configuration for MediaTek C…

    …hip.
    
    The MediaTek chip support vendor specific HCI command(0xfc1a) to
    change the public address. Add hdev->set_bdaddr handler for MediaTek
    Chip. After doing a power cycle or MediaTek Bluetooth reset, BD_ADDR
    will bring back the original one.
    
    Signed-off-by: mark-yw.chen <mark-yw.chen@mediatek.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    mark-yw.chen authored and holtmann committed Sep 1, 2021
  4. Bluetooth: fix use-after-free error in lock_sock_nested()

    use-after-free error in lock_sock_nested is reported:
    
    [  179.140137][ T3731] =====================================================
    [  179.142675][ T3731] BUG: KMSAN: use-after-free in lock_sock_nested+0x280/0x2c0
    [  179.145494][ T3731] CPU: 4 PID: 3731 Comm: kworker/4:2 Not tainted 5.12.0-rc6+ torvalds#54
    [  179.148432][ T3731] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
    [  179.151806][ T3731] Workqueue: events l2cap_chan_timeout
    [  179.152730][ T3731] Call Trace:
    [  179.153301][ T3731]  dump_stack+0x24c/0x2e0
    [  179.154063][ T3731]  kmsan_report+0xfb/0x1e0
    [  179.154855][ T3731]  __msan_warning+0x5c/0xa0
    [  179.155579][ T3731]  lock_sock_nested+0x280/0x2c0
    [  179.156436][ T3731]  ? kmsan_get_metadata+0x116/0x180
    [  179.157257][ T3731]  l2cap_sock_teardown_cb+0xb8/0x890
    [  179.158154][ T3731]  ? __msan_metadata_ptr_for_load_8+0x10/0x20
    [  179.159141][ T3731]  ? kmsan_get_metadata+0x116/0x180
    [  179.159994][ T3731]  ? kmsan_get_shadow_origin_ptr+0x84/0xb0
    [  179.160959][ T3731]  ? l2cap_sock_recv_cb+0x420/0x420
    [  179.161834][ T3731]  l2cap_chan_del+0x3e1/0x1d50
    [  179.162608][ T3731]  ? kmsan_get_metadata+0x116/0x180
    [  179.163435][ T3731]  ? kmsan_get_shadow_origin_ptr+0x84/0xb0
    [  179.164406][ T3731]  l2cap_chan_close+0xeea/0x1050
    [  179.165189][ T3731]  ? kmsan_internal_unpoison_shadow+0x42/0x70
    [  179.166180][ T3731]  l2cap_chan_timeout+0x1da/0x590
    [  179.167066][ T3731]  ? __msan_metadata_ptr_for_load_8+0x10/0x20
    [  179.168023][ T3731]  ? l2cap_chan_create+0x560/0x560
    [  179.168818][ T3731]  process_one_work+0x121d/0x1ff0
    [  179.169598][ T3731]  worker_thread+0x121b/0x2370
    [  179.170346][ T3731]  kthread+0x4ef/0x610
    [  179.171010][ T3731]  ? process_one_work+0x1ff0/0x1ff0
    [  179.171828][ T3731]  ? kthread_blkcg+0x110/0x110
    [  179.172587][ T3731]  ret_from_fork+0x1f/0x30
    [  179.173348][ T3731]
    [  179.173752][ T3731] Uninit was created at:
    [  179.174409][ T3731]  kmsan_internal_poison_shadow+0x5c/0xf0
    [  179.175373][ T3731]  kmsan_slab_free+0x76/0xc0
    [  179.176060][ T3731]  kfree+0x3a5/0x1180
    [  179.176664][ T3731]  __sk_destruct+0x8af/0xb80
    [  179.177375][ T3731]  __sk_free+0x812/0x8c0
    [  179.178032][ T3731]  sk_free+0x97/0x130
    [  179.178686][ T3731]  l2cap_sock_release+0x3d5/0x4d0
    [  179.179457][ T3731]  sock_close+0x150/0x450
    [  179.180117][ T3731]  __fput+0x6bd/0xf00
    [  179.180787][ T3731]  ____fput+0x37/0x40
    [  179.181481][ T3731]  task_work_run+0x140/0x280
    [  179.182219][ T3731]  do_exit+0xe51/0x3e60
    [  179.182930][ T3731]  do_group_exit+0x20e/0x450
    [  179.183656][ T3731]  get_signal+0x2dfb/0x38f0
    [  179.184344][ T3731]  arch_do_signal_or_restart+0xaa/0xe10
    [  179.185266][ T3731]  exit_to_user_mode_prepare+0x2d2/0x560
    [  179.186136][ T3731]  syscall_exit_to_user_mode+0x35/0x60
    [  179.186984][ T3731]  do_syscall_64+0xc5/0x140
    [  179.187681][ T3731]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    [  179.188604][ T3731] =====================================================
    
    In our case, there are two Thread A and B:
    
    Context: Thread A:              Context: Thread B:
    
    l2cap_chan_timeout()            __se_sys_shutdown()
      l2cap_chan_close()              l2cap_sock_shutdown()
        l2cap_chan_del()                l2cap_chan_close()
          l2cap_sock_teardown_cb()        l2cap_sock_teardown_cb()
    
    Once l2cap_sock_teardown_cb() excuted, this sock will be marked as SOCK_ZAPPED,
    and can be treated as killable in l2cap_sock_kill() if sock_orphan() has
    excuted, at this time we close sock through sock_close() which end to call
    l2cap_sock_kill() like Thread C:
    
    Context: Thread C:
    
    sock_close()
      l2cap_sock_release()
        sock_orphan()
        l2cap_sock_kill()  #free sock if refcnt is 1
    
    If C completed, Once A or B reaches l2cap_sock_teardown_cb() again,
    use-after-free happened.
    
    We should set chan->data to NULL if sock is destructed, for telling teardown
    operation is not allowed in l2cap_sock_teardown_cb(), and also we should
    avoid killing an already killed socket in l2cap_sock_close_cb().
    
    Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Wang ShaoBo authored and holtmann committed Sep 1, 2021

Commits on Aug 31, 2021

  1. Bluetooth: btintel: Read boot address irrespective of controller mode

    Boot address was not getting updated when controller is present
    in boot mode which is required to move the controller from boot mode
    to operation mode after firmware download. This patch reads boot address
    even if controller is present in boot mode.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    kirankrishnappa-intel authored and holtmann committed Aug 31, 2021
  2. Bluetooth: btintel: Fix boot address

    Cache Boot address present in firmware file which
    is later used in Intel_Soft_Reset command to bring
    controller from boot mode to operational mode.
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    kirankrishnappa-intel authored and holtmann committed Aug 31, 2021
Older