<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/net/bluetooth/hci_request.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/net/bluetooth/hci_request.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/net/bluetooth/hci_request.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-06-05T23:28:41Z</updated>
<entry>
<title>bluetooth: don't use bitmaps for random flag accesses</title>
<updated>2022-06-05T23:28:41Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-05T18:51:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e1cff7002b716bd0b5f5f4afd4273c99aa8644be'/>
<id>urn:sha1:e1cff7002b716bd0b5f5f4afd4273c99aa8644be</id>
<content type='text'>
The bluetooth code uses our bitmap infrastructure for the two bits (!)
of connection setup flags, and in the process causes odd problems when
it converts between a bitmap and just the regular values of said bits.

It's completely pointless to do things like bitmap_to_arr32() to convert
a bitmap into a u32.  It shoudln't have been a bitmap in the first
place.  The reason to use bitmaps is if you have arbitrary number of
bits you want to manage (not two!), or if you rely on the atomicity
guarantees of the bitmap setting and clearing.

The code could use an "atomic_t" and use "atomic_or/andnot()" to set and
clear the bit values, but considering that it then copies the bitmaps
around with "bitmap_to_arr32()" and friends, there clearly cannot be a
lot of atomicity requirements.

So just use a regular integer.

In the process, this avoids the warnings about erroneous use of
bitmap_from_u64() which were triggered on 32-bit architectures when
conversion from a u64 would access two words (and, surprise, surprise,
only one word is needed - and indeed overkill - for a 2-bit bitmap).

That was always problematic, but the compiler seems to notice it and
warn about the invalid pattern only after commit 0a97953fd221 ("lib: add
bitmap_{from,to}_arr64") changed the exact implementation details of
'bitmap_from_u64()', as reported by Sudip Mukherjee and Stephen Rothwell.

Fixes: fe92ee6425a2 ("Bluetooth: hci_core: Rework hci_conn_params flags")
Link: https://lore.kernel.org/all/YpyJ9qTNHJzz0FHY@debian/
Link: https://lore.kernel.org/all/20220606080631.0c3014f2@canb.auug.org.au/
Link: https://lore.kernel.org/all/20220605162537.1604762-1-yury.norov@gmail.com/
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reported-by: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt;
Reviewed-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Cc: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_sync: use hci_skb_event() helper</title>
<updated>2022-05-23T15:21:59Z</updated>
<author>
<name>Ahmad Fatoum</name>
<email>a.fatoum@pengutronix.de</email>
</author>
<published>2022-05-21T20:10:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=edcb185fa9c4f8fa1301f032fb503d2597a92b1e'/>
<id>urn:sha1:edcb185fa9c4f8fa1301f032fb503d2597a92b1e</id>
<content type='text'>
This instance is the only opencoded version of the macro, so have it
follow suit.

Signed-off-by: Ahmad Fatoum &lt;a.fatoum@pengutronix.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: use hdev lock in activate_scan for hci_is_adv_monitoring</title>
<updated>2022-05-13T11:05:49Z</updated>
<author>
<name>Niels Dossche</name>
<email>dossche.niels@gmail.com</email>
</author>
<published>2022-04-07T18:06:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=50a3633ae5e98cf1b80ef5b73c9e341aee9ad896'/>
<id>urn:sha1:50a3633ae5e98cf1b80ef5b73c9e341aee9ad896</id>
<content type='text'>
hci_is_adv_monitoring's function documentation states that it must be
called under the hdev lock. Paths that leads to an unlocked call are:
discov_update =&gt; start_discovery =&gt; interleaved_discov =&gt; active_scan
and: discov_update =&gt; start_discovery =&gt; active_scan

The solution is to take the lock in active_scan during the duration of
the call to hci_is_adv_monitoring.

Fixes: c32d624640fd ("Bluetooth: disable filter dup when scan for adv monitor")
Signed-off-by: Niels Dossche &lt;dossche.niels@gmail.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_sync: Add hci_le_create_conn_sync</title>
<updated>2021-12-22T22:01:35Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-12-22T20:21:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8e8b92ee60de5341e9db83c11f75a525e555e2b3'/>
<id>urn:sha1:8e8b92ee60de5341e9db83c11f75a525e555e2b3</id>
<content type='text'>
This adds hci_le_create_conn_sync and make hci_le_connect use it instead
of queueing multiple commands which may conflict with the likes of
hci_update_passive_scan which uses hci_cmd_sync_queue.

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: hci_sync: Push sync command cancellation to workqueue</title>
<updated>2021-12-22T22:01:27Z</updated>
<author>
<name>Benjamin Berg</name>
<email>bberg@redhat.com</email>
</author>
<published>2021-12-17T15:28:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=744451c162a514044a912cbbd64b7a386035cc5b'/>
<id>urn:sha1:744451c162a514044a912cbbd64b7a386035cc5b</id>
<content type='text'>
syzbot reported that hci_cmd_sync_cancel may sleep from the wrong
context. To avoid this, create a new work item that pushes the relevant
parts into a different context.

Note that we keep the old implementation with the name
__hci_cmd_sync_cancel as the sleeping behaviour is desired in some
cases.

Reported-and-tested-by: syzbot+485cc00ea7cf41dfdbf1@syzkaller.appspotmail.com
Fixes: c97a747efc93 ("Bluetooth: btusb: Cancel sync commands for certain URB errors")
Signed-off-by: Benjamin Berg &lt;bberg@redhat.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_core: Rework hci_conn_params flags</title>
<updated>2021-12-07T16:05:51Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-12-01T19:49:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fe92ee6425a2c79ee84f0b9b8a14117200d15f7d'/>
<id>urn:sha1:fe92ee6425a2c79ee84f0b9b8a14117200d15f7d</id>
<content type='text'>
This reworks hci_conn_params flags to use bitmap_* helpers and add
support for setting the supported flags in hdev-&gt;conn_flags so it can
easily be accessed.

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 hci_cmd_sync_cancel to public API</title>
<updated>2021-12-03T18:41:59Z</updated>
<author>
<name>Benjamin Berg</name>
<email>bberg@redhat.com</email>
</author>
<published>2021-12-03T14:59:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=914b08b330d6722ed081e14580aae6fe66cd5946'/>
<id>urn:sha1:914b08b330d6722ed081e14580aae6fe66cd5946</id>
<content type='text'>
After transfer errors it makes sense to cancel an ongoing synchronous
command that cannot complete anymore. To permit this, export the old
hci_req_sync_cancel function as hci_cmd_sync_cancel in the API.

Signed-off-by: Benjamin Berg &lt;bberg@redhat.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Reset more state when cancelling a sync command</title>
<updated>2021-12-03T18:41:59Z</updated>
<author>
<name>Benjamin Berg</name>
<email>bberg@redhat.com</email>
</author>
<published>2021-12-03T14:58:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ae422391e17d30a2fb1d0968142dcd1e4cdc172a'/>
<id>urn:sha1:ae422391e17d30a2fb1d0968142dcd1e4cdc172a</id>
<content type='text'>
Resetting the timers and cmd_cnt means that we assume the device will be
in a good state after the sync command finishes. Without this a chain of
synchronous commands might get stuck if one of them is cancelled.

Signed-off-by: Benjamin Berg &lt;bberg@redhat.com&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_request: Remove bg_scan_update work</title>
<updated>2021-11-16T14:13:34Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-11-12T00:48:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9482c5074a7d0bec682cc35a12d687f185684f31'/>
<id>urn:sha1:9482c5074a7d0bec682cc35a12d687f185684f31</id>
<content type='text'>
This work is no longer necessary since all the code using it has been
converted to use hci_passive_scan/hci_passive_scan_sync.

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: hci_sync: Convert MGMT_OP_SET_CONNECTABLE to use cmd_sync</title>
<updated>2021-11-16T14:13:34Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2021-11-12T00:48:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f056a65783cce9c1279c1635d92768ce5962e4d6'/>
<id>urn:sha1:f056a65783cce9c1279c1635d92768ce5962e4d6</id>
<content type='text'>
This makes MGMT_OP_SET_CONNEABLE use hci_cmd_sync_queue instead of
use a dedicated connetable_update work.

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>
</feed>
