<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/net/bluetooth/sco.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/net/bluetooth/sco.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/net/bluetooth/sco.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-05-13T11:05:48Z</updated>
<entry>
<title>Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk</title>
<updated>2022-05-13T11:05:48Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2022-04-01T23:38:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=05abad857277dda198063017b00ba5b9fed2c0cb'/>
<id>urn:sha1:05abad857277dda198063017b00ba5b9fed2c0cb</id>
<content type='text'>
This adds HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk which can be
used to mark HCI_Enhanced_Setup_Synchronous_Connection as broken even
if its support command bit are set since some controller report it as
supported but the command don't work properly with some configurations
(e.g. BT_VOICE_TRANSPARENT/mSBC).

Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: fix dangling sco_conn and use-after-free in sco_sock_timeout</title>
<updated>2022-05-13T11:05:48Z</updated>
<author>
<name>Ying Hsu</name>
<email>yinghsu@chromium.org</email>
</author>
<published>2022-03-26T07:09:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=7aa1e7d15f8a5b65f67bacb100d8fc033b21efa2'/>
<id>urn:sha1:7aa1e7d15f8a5b65f67bacb100d8fc033b21efa2</id>
<content type='text'>
Connecting the same socket twice consecutively in sco_sock_connect()
could lead to a race condition where two sco_conn objects are created
but only one is associated with the socket. If the socket is closed
before the SCO connection is established, the timer associated with the
dangling sco_conn object won't be canceled. As the sock object is being
freed, the use-after-free problem happens when the timer callback
function sco_sock_timeout() accesses the socket. Here's the call trace:

dump_stack+0x107/0x163
? refcount_inc+0x1c/
print_address_description.constprop.0+0x1c/0x47e
? refcount_inc+0x1c/0x7b
kasan_report+0x13a/0x173
? refcount_inc+0x1c/0x7b
check_memory_region+0x132/0x139
refcount_inc+0x1c/0x7b
sco_sock_timeout+0xb2/0x1ba
process_one_work+0x739/0xbd1
? cancel_delayed_work+0x13f/0x13f
? __raw_spin_lock_init+0xf0/0xf0
? to_kthread+0x59/0x85
worker_thread+0x593/0x70e
kthread+0x346/0x35a
? drain_workqueue+0x31a/0x31a
? kthread_bind+0x4b/0x4b
ret_from_fork+0x1f/0x30

Link: https://syzkaller.appspot.com/bug?extid=2bef95d3ab4daa10155b
Reported-by: syzbot+2bef95d3ab4daa10155b@syzkaller.appspotmail.com
Fixes: e1dee2c1de2b ("Bluetooth: fix repeated calls to sco_sock_kill")
Signed-off-by: Ying Hsu &lt;yinghsu@chromium.org&gt;
Reviewed-by: Joseph Hwang &lt;josephsih@chromium.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: SCO: Fix sco_send_frame returning skb-&gt;len</title>
<updated>2021-09-21T08:44:52Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-09-16T20:10:49Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=037ce005af6b8a3e40ee07c6e9266c8997e6a4d6'/>
<id>urn:sha1:037ce005af6b8a3e40ee07c6e9266c8997e6a4d6</id>
<content type='text'>
The skb in modified by hci_send_sco which pushes SCO headers thus
changing skb-&gt;len causing sco_sock_sendmsg to fail.

Fixes: 0771cbb3b97d ("Bluetooth: SCO: Replace use of memcpy_from_msg with bt_skb_sendmsg")
Tested-by: Tedd Ho-Jeong An &lt;tedd.an@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix passing NULL to PTR_ERR</title>
<updated>2021-09-21T08:44:52Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-09-16T20:10:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=266191aa8d14b84958aaeb5e96ee4e97839e3d87'/>
<id>urn:sha1:266191aa8d14b84958aaeb5e96ee4e97839e3d87</id>
<content type='text'>
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 &lt;dan.carpenter@oracle.com&gt;
Tested-by: Tedd Ho-Jeong An &lt;tedd.an@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: SCO: Replace use of memcpy_from_msg with bt_skb_sendmsg</title>
<updated>2021-09-13T19:53:23Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-09-03T22:27:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0771cbb3b97d3c1d68eecd7f00055f599954c34e'/>
<id>urn:sha1:0771cbb3b97d3c1d68eecd7f00055f599954c34e</id>
<content type='text'>
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 &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command</title>
<updated>2021-09-07T21:09:18Z</updated>
<author>
<name>Kiran K</name>
<email>kiran.k@intel.com</email>
</author>
<published>2021-09-07T10:12:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b2af264ad3af437238c9500aa830ebcafb180e05'/>
<id>urn:sha1:b2af264ad3af437238c9500aa830ebcafb180e05</id>
<content type='text'>
&lt; 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)
&gt; HCI Event: Command Status (0x0f) plen 4
      Enhanced Setup Synchronous Connection (0x01|0x003d) ncmd 1
        Status: Success (0x00)
&gt; 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 &lt;kiran.k@intel.com&gt;
Reviewed-by: Chethan T N &lt;chethan.tumkur.narayan@intel.com&gt;
Reviewed-by: Srivatsa Ravishankar &lt;ravishankar.srivatsa@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Allow setting of codec for HFP offload use case</title>
<updated>2021-09-07T21:09:18Z</updated>
<author>
<name>Kiran K</name>
<email>kiran.k@intel.com</email>
</author>
<published>2021-09-07T10:12:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f6873401a60865702069fb2e3f67671fff9c082c'/>
<id>urn:sha1:f6873401a60865702069fb2e3f67671fff9c082c</id>
<content type='text'>
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 &lt;kiran.k@intel.com&gt;
Reviewed-by: Chethan T N &lt;chethan.tumkur.narayan@intel.com&gt;
Reviewed-by: Srivatsa Ravishankar &lt;ravishankar.srivatsa@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Allow querying of supported offload codecs over SCO socket</title>
<updated>2021-09-07T21:09:18Z</updated>
<author>
<name>Kiran K</name>
<email>kiran.k@intel.com</email>
</author>
<published>2021-09-07T10:12:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=248733e87d503e75624a2e95e241f51334fdd320'/>
<id>urn:sha1:248733e87d503e75624a2e95e241f51334fdd320</id>
<content type='text'>
Add BT_CODEC option for getsockopt systemcall to get the details
of offload codecs supported over SCO socket

Signed-off-by: Kiran K &lt;kiran.k@intel.com&gt;
Reviewed-by: Chethan T N &lt;chethan.tumkur.narayan@intel.com&gt;
Reviewed-by: Srivatsa Ravishankar &lt;ravishankar.srivatsa@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: fix init and cleanup of sco_conn.timeout_work</title>
<updated>2021-09-03T23:33:10Z</updated>
<author>
<name>Desmond Cheong Zhi Xi</name>
<email>desmondcheongzx@gmail.com</email>
</author>
<published>2021-09-03T03:13:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=49d8a5606428ca0962d09050a5af81461ff90fbb'/>
<id>urn:sha1:49d8a5606428ca0962d09050a5af81461ff90fbb</id>
<content type='text'>
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: ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
Signed-off-by: Desmond Cheong Zhi Xi &lt;desmondcheongzx@gmail.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: call sock_hold earlier in sco_conn_del</title>
<updated>2021-09-03T23:33:10Z</updated>
<author>
<name>Desmond Cheong Zhi Xi</name>
<email>desmondcheongzx@gmail.com</email>
</author>
<published>2021-09-03T03:13:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f4712fa993f688d0a48e0c28728fcdeb88c1ea58'/>
<id>urn:sha1:f4712fa993f688d0a48e0c28728fcdeb88c1ea58</id>
<content type='text'>
In sco_conn_del, conn-&gt;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 &lt;desmondcheongzx@gmail.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
</feed>
