<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/net/bluetooth, branch v5.8.5</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.8.5</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.8.5'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2020-08-19T06:26:46Z</updated>
<entry>
<title>Bluetooth: btusb: Fix and detect most of the Chinese Bluetooth controllers</title>
<updated>2020-08-19T06:26:46Z</updated>
<author>
<name>Ismael Ferreras Morezuelas</name>
<email>swyterzone@gmail.com</email>
</author>
<published>2020-07-26T21:12:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=267dac50f18eb00cb43c81197907b4df57b8b4c4'/>
<id>urn:sha1:267dac50f18eb00cb43c81197907b4df57b8b4c4</id>
<content type='text'>
[ Upstream commit cde1a8a992875a7479c4321b2a4a190c2e92ec2a ]

For some reason they tend to squat on the very first CSR/
Cambridge Silicon Radio VID/PID instead of paying fees.

This is an extremely common problem; the issue goes as back as 2013
and these devices are only getting more popular, even rebranded by
reputable vendors and sold by retailers everywhere.

So, at this point in time there are hundreds of modern dongles reusing
the ID of what originally was an early Bluetooth 1.1 controller.

Linux is the only place where they don't work due to spotty checks
in our detection code. It only covered a minimum subset.

So what's the big idea? Take advantage of the fact that all CSR
chips report the same internal version as both the LMP sub-version and
HCI revision number. It always matches, couple that with the manufacturer
code, that rarely lies, and we now have a good idea of who is who.

Additionally, by compiling a list of user-reported HCI/lsusb dumps, and
searching around for legit CSR dongles in similar product ranges we can
find what CSR BlueCore firmware supported which Bluetooth versions.

That way we can narrow down ranges of fakes for each of them.

e.g. Real CSR dongles with LMP subversion 0x73 are old enough that
     support BT 1.1 only; so it's a dead giveaway when some
     third-party BT 4.0 dongle reuses it.

So, to sum things up; there are multiple classes of fake controllers
reusing the same 0A12:0001 VID/PID. This has been broken for a while.

Known 'fake' bcdDevices: 0x0100, 0x0134, 0x1915, 0x2520, 0x7558, 0x8891
  IC markings on 0x7558: FR3191AHAL 749H15143 (???)

https://bugzilla.kernel.org/show_bug.cgi?id=60824

Fixes: 81cac64ba258ae (Deal with USB devices that are faking CSR vendor)
Reported-by: Michał Wiśniewski &lt;brylozketrzyn@gmail.com&gt;
Tested-by: Mike Johnson &lt;yuyuyak@gmail.com&gt;
Tested-by: Ricardo Rodrigues &lt;ekatonb@gmail.com&gt;
Tested-by: M.Hanny Sabbagh &lt;mhsabbagh@outlook.com&gt;
Tested-by: Oussama BEN BRAHIM &lt;b.brahim.oussama@gmail.com&gt;
Tested-by: Ismael Ferreras Morezuelas &lt;swyterzone@gmail.com&gt;
Signed-off-by: Ismael Ferreras Morezuelas &lt;swyterzone@gmail.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix update of connection state in `hci_encrypt_cfm`</title>
<updated>2020-08-19T06:26:35Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2020-07-15T17:43:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=99d321c2a921e5315e72cc7199377b4b2c27b766'/>
<id>urn:sha1:99d321c2a921e5315e72cc7199377b4b2c27b766</id>
<content type='text'>
[ Upstream commit 339ddaa626995bc6218972ca241471f3717cc5f4 ]

Starting with the upgrade to v5.8-rc3, I've noticed I wasn't able to
connect to my Bluetooth headset properly anymore. While connecting to
the device would eventually succeed, bluetoothd seemed to be confused
about the current connection state where the state was flapping hence
and forth. Bisecting this issue led to commit 3ca44c16b0dc (Bluetooth:
Consolidate encryption handling in hci_encrypt_cfm, 2020-05-19), which
refactored `hci_encrypt_cfm` to also handle updating the connection
state.

The commit in question changed the code to call `hci_connect_cfm` inside
`hci_encrypt_cfm` and to change the connection state. But with the
conversion, we now only update the connection state if a status was set
already. In fact, the reverse should be true: the status should be
updated if no status is yet set. So let's fix the isuse by reversing the
condition.

Fixes: 3ca44c16b0dc ("Bluetooth: Consolidate encryption handling in hci_encrypt_cfm")
Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Acked-by:  Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Consolidate encryption handling in hci_encrypt_cfm</title>
<updated>2020-05-20T14:30:33Z</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2020-05-19T20:25:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3ca44c16b0dcc764b641ee4ac226909f5c421aa3'/>
<id>urn:sha1:3ca44c16b0dcc764b641ee4ac226909f5c421aa3</id>
<content type='text'>
This makes hci_encrypt_cfm calls hci_connect_cfm in case the connection
state is BT_CONFIG so callers don't have to check the state.

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: L2CAP: Replace zero-length array with flexible-array</title>
<updated>2020-05-18T07:57:41Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavoars@kernel.org</email>
</author>
<published>2020-05-13T17:15:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=631512f868a4a49a48bda753752d085621c68112'/>
<id>urn:sha1:631512f868a4a49a48bda753752d085621c68112</id>
<content type='text'>
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Add hook for driver to prevent wake from suspend</title>
<updated>2020-05-13T07:12:04Z</updated>
<author>
<name>Abhishek Pandit-Subedi</name>
<email>abhishekpandit@chromium.org</email>
</author>
<published>2020-05-13T02:19:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=81dafad53c67abe4f09b0b04131fe490e76e5602'/>
<id>urn:sha1:81dafad53c67abe4f09b0b04131fe490e76e5602</id>
<content type='text'>
Let drivers have a hook to disable configuring scanning during suspend.
Drivers should use the device_may_wakeup function call to determine
whether hci should be configured for wakeup.

For example, an implementation for btusb may look like the following:

  bool btusb_prevent_wake(struct hci_dev *hdev)
  {
        struct btusb_data *data = hci_get_drvdata(hdev);
        return !device_may_wakeup(&amp;data-&gt;udev-&gt;dev);
  }

Signed-off-by: Abhishek Pandit-Subedi &lt;abhishekpandit@chromium.org&gt;
Reviewed-by: Alain Michaud &lt;alainm@chromium.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Rename BT_SUSPEND_COMPLETE</title>
<updated>2020-05-13T07:12:04Z</updated>
<author>
<name>Abhishek Pandit-Subedi</name>
<email>abhishekpandit@chromium.org</email>
</author>
<published>2020-05-13T02:19:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0d2c9825e46d45f8a520135c9c791b5c73a165ab'/>
<id>urn:sha1:0d2c9825e46d45f8a520135c9c791b5c73a165ab</id>
<content type='text'>
Renamed BT_SUSPEND_COMPLETE to BT_SUSPEND_CONFIGURE_WAKE since it sets
up the event filter and whitelist for wake-up.

Signed-off-by: Abhishek Pandit-Subedi &lt;abhishekpandit@chromium.org&gt;
Reviewed-by: Alain Michaud &lt;alainm@chromium.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Introduce debug feature when dynamic debug is disabled</title>
<updated>2020-05-11T10:16:27Z</updated>
<author>
<name>Marcel Holtmann</name>
<email>marcel@holtmann.org</email>
</author>
<published>2020-05-06T07:57:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e625e50ceee18bc1e3fb1a6375e089405a797a4d'/>
<id>urn:sha1:e625e50ceee18bc1e3fb1a6375e089405a797a4d</id>
<content type='text'>
In case dynamic debug is disabled, this feature allows a vendor platform
to provide debug statement printing.

Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Add support for experimental features configuration</title>
<updated>2020-05-11T10:13:38Z</updated>
<author>
<name>Marcel Holtmann</name>
<email>marcel@holtmann.org</email>
</author>
<published>2020-05-06T07:57:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a10c907ce0e5e138c3da091fcb7c3d109a15aec5'/>
<id>urn:sha1:a10c907ce0e5e138c3da091fcb7c3d109a15aec5</id>
<content type='text'>
To enable platform specific experimental features, introduce this new set of
management commands and events.

Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Introduce HCI_MGMT_HDEV_OPTIONAL option</title>
<updated>2020-05-11T10:13:38Z</updated>
<author>
<name>Marcel Holtmann</name>
<email>marcel@holtmann.org</email>
</author>
<published>2020-05-06T07:57:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d5cc6626b33780699c7a4986f3521361306862fe'/>
<id>urn:sha1:d5cc6626b33780699c7a4986f3521361306862fe</id>
<content type='text'>
When setting HCI_MGMT_HDEV_OPTIONAL it is possible to target a specific
conntroller or a global interface.

Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: replace zero-length array with flexible-array member</title>
<updated>2020-05-11T10:13:38Z</updated>
<author>
<name>Marcel Holtmann</name>
<email>marcel@holtmann.org</email>
</author>
<published>2020-05-06T07:57:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=14a81bf021fb428d1df484dba37bea155e8eec0f'/>
<id>urn:sha1:14a81bf021fb428d1df484dba37bea155e8eec0f</id>
<content type='text'>
The current codebase makes use of the zero-length array language extension
to the C90 standard, but the preferred mechanism to declare variable-length
types such as these ones is a flexible array member.

Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
</entry>
</feed>
