<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/bluetooth, branch v6.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-06-06T00:24:14Z</updated>
<entry>
<title>Bluetooth: L2CAP: Add missing checks for invalid DCID</title>
<updated>2023-06-06T00:24:14Z</updated>
<author>
<name>Sungwoo Kim</name>
<email>iam@sung-woo.kim</email>
</author>
<published>2023-06-03T12:28:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=75767213f3d9b97f63694d02260b6a49a2271876'/>
<id>urn:sha1:75767213f3d9b97f63694d02260b6a49a2271876</id>
<content type='text'>
When receiving a connect response we should make sure that the DCID is
within the valid range and that we don't already have another channel
allocated for the same DCID.
Missing checks may violate the specification (BLUETOOTH CORE SPECIFICATION
Version 5.4 | Vol 3, Part A, Page 1046).

Fixes: 40624183c202 ("Bluetooth: L2CAP: Add missing checks for invalid LE DCID")
Signed-off-by: Sungwoo Kim &lt;iam@sung-woo.kim&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: ISO: use correct CIS order in Set CIG Parameters event</title>
<updated>2023-06-06T00:14:07Z</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2023-06-01T06:34:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=71e9588435c38112d6a8686d3d8e7cc1de8fe22c'/>
<id>urn:sha1:71e9588435c38112d6a8686d3d8e7cc1de8fe22c</id>
<content type='text'>
The order of CIS handle array in Set CIG Parameters response shall match
the order of the CIS_ID array in the command (Core v5.3 Vol 4 Part E Sec
7.8.97).  We send CIS_IDs mainly in the order of increasing CIS_ID (but
with "last" CIS first if it has fixed CIG_ID).  In handling of the
reply, we currently assume this is also the same as the order of
hci_conn in hdev-&gt;conn_hash, but that is not true.

Match the correct hci_conn to the correct handle by matching them based
on the CIG+CIS combination.  The CIG+CIS combination shall be unique for
ISO_LINK hci_conn at state &gt;= BT_BOUND, which we maintain in
hci_le_set_cig_params.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: ISO: don't try to remove CIG if there are bound CIS left</title>
<updated>2023-06-06T00:14:07Z</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2023-06-01T06:34:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6c242c64a09e78349fb0a5f0a6f8076a3d7c0bb4'/>
<id>urn:sha1:6c242c64a09e78349fb0a5f0a6f8076a3d7c0bb4</id>
<content type='text'>
Consider existing BOUND &amp; CONNECT state CIS to block CIG removal.
Otherwise, under suitable timing conditions we may attempt to remove CIG
while Create CIS is pending, which fails.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix l2cap_disconnect_req deadlock</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Ying Hsu</name>
<email>yinghsu@chromium.org</email>
</author>
<published>2023-05-31T03:44:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=02c5ea5246a44d6ffde0fddebfc1d56188052976'/>
<id>urn:sha1:02c5ea5246a44d6ffde0fddebfc1d56188052976</id>
<content type='text'>
L2CAP assumes that the locks conn-&gt;chan_lock and chan-&gt;lock are
acquired in the order conn-&gt;chan_lock, chan-&gt;lock to avoid
potential deadlock.
For example, l2sock_shutdown acquires these locks in the order:
  mutex_lock(&amp;conn-&gt;chan_lock)
  l2cap_chan_lock(chan)

However, l2cap_disconnect_req acquires chan-&gt;lock in
l2cap_get_chan_by_scid first and then acquires conn-&gt;chan_lock
before calling l2cap_chan_del. This means that these locks are
acquired in unexpected order, which leads to potential deadlock:
  l2cap_chan_lock(c)
  mutex_lock(&amp;conn-&gt;chan_lock)

This patch releases chan-&gt;lock before acquiring the conn_chan_lock
to avoid the potential deadlock.

Fixes: a2a9339e1c9d ("Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}")
Signed-off-by: Ying Hsu &lt;yinghsu@chromium.org&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: fix debugfs registration</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Johan Hovold</name>
<email>johan+linaro@kernel.org</email>
</author>
<published>2023-05-31T08:57:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fe2ccc6c29d53e14d3c8b3ddf8ad965a92e074ee'/>
<id>urn:sha1:fe2ccc6c29d53e14d3c8b3ddf8ad965a92e074ee</id>
<content type='text'>
Since commit ec6cef9cd98d ("Bluetooth: Fix SMP channel registration for
unconfigured controllers") the debugfs interface for unconfigured
controllers will be created when the controller is configured.

There is however currently nothing preventing a controller from being
configured multiple time (e.g. setting the device address using btmgmt)
which results in failed attempts to register the already registered
debugfs entries:

	debugfs: File 'features' in directory 'hci0' already present!
	debugfs: File 'manufacturer' in directory 'hci0' already present!
	debugfs: File 'hci_version' in directory 'hci0' already present!
	...
	debugfs: File 'quirk_simultaneous_discovery' in directory 'hci0' already present!

Add a controller flag to avoid trying to register the debugfs interface
more than once.

Fixes: ec6cef9cd98d ("Bluetooth: Fix SMP channel registration for unconfigured controllers")
Cc: stable@vger.kernel.org      # 4.0
Signed-off-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_sync: add lock to protect HCI_UNREGISTER</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Zhengping Jiang</name>
<email>jiangzp@google.com</email>
</author>
<published>2023-05-25T00:11:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1857c19941c87eb36ad47f22a406be5dfe5eff9f'/>
<id>urn:sha1:1857c19941c87eb36ad47f22a406be5dfe5eff9f</id>
<content type='text'>
When the HCI_UNREGISTER flag is set, no jobs should be scheduled. Fix
potential race when HCI_UNREGISTER is set after the flag is tested in
hci_cmd_sync_queue.

Fixes: 0b94f2651f56 ("Bluetooth: hci_sync: Fix queuing commands when HCI_UNREGISTER is set")
Signed-off-by: Zhengping Jiang &lt;jiangzp@google.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix use-after-free in hci_remove_ltk/hci_remove_irk</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2023-05-30T20:48:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c5d2b6fa26b5b8386a9cc902cdece3a46bef2bd2'/>
<id>urn:sha1:c5d2b6fa26b5b8386a9cc902cdece3a46bef2bd2</id>
<content type='text'>
Similar to commit 0f7d9b31ce7a ("netfilter: nf_tables: fix use-after-free
in nft_set_catchall_destroy()"). We can not access k after kfree_rcu()
call.

Cc: stable@vger.kernel.org
Signed-off-by: Min Li &lt;lm0963hack@gmail.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: ISO: Fix CIG auto-allocation to select configurable CIG</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2023-05-21T15:48:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e6a7a46b8636efe95c75bed63a57fc05c13feba4'/>
<id>urn:sha1:e6a7a46b8636efe95c75bed63a57fc05c13feba4</id>
<content type='text'>
Make CIG auto-allocation to select the first CIG_ID that is still
configurable. Also use correct CIG_ID range (see Core v5.3 Vol 4 Part E
Sec 7.8.97 p.2553).

Previously, it would always select CIG_ID 0 regardless of anything,
because cis_list with data.cis == 0xff (BT_ISO_QOS_CIS_UNSET) would not
count any CIS. Since we are not adding CIS here, use find_cis instead.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: ISO: consider right CIS when removing CIG at cleanup</title>
<updated>2023-06-06T00:13:14Z</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2023-05-21T15:48:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=31c5f9164949347c9cb34f041a7e04fdc08b1b85'/>
<id>urn:sha1:31c5f9164949347c9cb34f041a7e04fdc08b1b85</id>
<content type='text'>
When looking for CIS blocking CIG removal, consider only the CIS with
the right CIG ID. Don't try to remove CIG with unset CIG ID.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Unlink CISes when LE disconnects in hci_conn_del</title>
<updated>2023-05-19T22:37:45Z</updated>
<author>
<name>Ruihan Li</name>
<email>lrh2000@pku.edu.cn</email>
</author>
<published>2023-05-03T13:39:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a2904d2825536aa896a149a9174d11b0958e7095'/>
<id>urn:sha1:a2904d2825536aa896a149a9174d11b0958e7095</id>
<content type='text'>
Currently, hci_conn_del calls hci_conn_unlink for BR/EDR, (e)SCO, and
CIS connections, i.e., everything except LE connections. However, if
(e)SCO connections are unlinked when BR/EDR disconnects, CIS connections
should also be unlinked when LE disconnects.

In terms of disconnection behavior, CIS and (e)SCO connections are not
too different. One peculiarity of CIS is that when CIS connections are
disconnected, the CIS handle isn't deleted, as per [BLUETOOTH CORE
SPECIFICATION Version 5.4 | Vol 4, Part E] 7.1.6 Disconnect command:

        All SCO, eSCO, and CIS connections on a physical link should be
        disconnected before the ACL connection on the same physical
        connection is disconnected. If it does not, they will be
        implicitly disconnected as part of the ACL disconnection.
        ...
        Note: As specified in Section 7.7.5, on the Central, the handle
        for a CIS remains valid even after disconnection and, therefore,
        the Host can recreate a disconnected CIS at a later point in
        time using the same connection handle.

Since hci_conn_link invokes both hci_conn_get and hci_conn_hold,
hci_conn_unlink should perform both hci_conn_put and hci_conn_drop as
well. However, currently it performs only hci_conn_put.

This patch makes hci_conn_unlink call hci_conn_drop as well, which
simplifies the logic in hci_conn_del a bit and may benefit future users
of hci_conn_unlink. But it is noted that this change additionally
implies that hci_conn_unlink can queue disc_work on conn itself, with
the following call stack:

        hci_conn_unlink(conn)  [conn-&gt;parent == NULL]
                -&gt; hci_conn_unlink(child)  [child-&gt;parent == conn]
                        -&gt; hci_conn_drop(child-&gt;parent)
                                -&gt; queue_delayed_work(&amp;conn-&gt;disc_work)

Queued disc_work after hci_conn_del can be spurious, so during the
process of hci_conn_del, it is necessary to make the call to
cancel_delayed_work(&amp;conn-&gt;disc_work) after invoking hci_conn_unlink.

Signed-off-by: Ruihan Li &lt;lrh2000@pku.edu.cn&gt;
Co-developed-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
</feed>
