<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/bluetooth/hci_serdev.c, branch v4.14.286</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.286</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.286'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-10-29T08:07:03+00:00</updated>
<entry>
<title>Bluetooth: hci_uart: Cancel init work before unregistering</title>
<updated>2020-10-29T08:07:03+00:00</updated>
<author>
<name>Samuel Holland</name>
<email>samuel@sholland.org</email>
</author>
<published>2020-08-01T16:29:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cd27019bc149f20f12ebec943c2b4c775745a5a0'/>
<id>urn:sha1:cd27019bc149f20f12ebec943c2b4c775745a5a0</id>
<content type='text'>
[ Upstream commit 3b799254cf6f481460719023d7a18f46651e5e7f ]

If hci_uart_tty_close() or hci_uart_unregister_device() is called while
hu-&gt;init_ready is scheduled, hci_register_dev() could be called after
the hci_uart is torn down. Avoid this by ensuring the work is complete
or canceled before checking the HCI_UART_REGISTERED flag.

Fixes: 9f2aee848fe6 ("Bluetooth: Add delayed init sequence support for UART controllers")
Signed-off-by: Samuel Holland &lt;samuel@sholland.org&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: hci_serdev: Only unregister device if it was registered</title>
<updated>2020-08-21T07:48:11+00:00</updated>
<author>
<name>Nicolas Boichat</name>
<email>drinkcat@chromium.org</email>
</author>
<published>2020-07-21T02:37:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=36bac0f1d441fc6603017dd5881a3641f011fbd5'/>
<id>urn:sha1:36bac0f1d441fc6603017dd5881a3641f011fbd5</id>
<content type='text'>
[ Upstream commit 202798db9570104728dce8bb57dfeed47ce764bc ]

We should not call hci_unregister_dev if the device was not
successfully registered.

Fixes: c34dc3bfa7642fd ("Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()")
Signed-off-by: Nicolas Boichat &lt;drinkcat@chromium.org&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: hci_serdev: clear HCI_UART_PROTO_READY to avoid closing proto races</title>
<updated>2019-11-20T17:00:46+00:00</updated>
<author>
<name>Balakrishna Godavarthi</name>
<email>bgodavar@codeaurora.org</email>
</author>
<published>2018-08-22T12:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=191e19752460e0cabfe0a95a75a9a1ddd9b1cdd7'/>
<id>urn:sha1:191e19752460e0cabfe0a95a75a9a1ddd9b1cdd7</id>
<content type='text'>
[ Upstream commit 7cf7846d27bfc9731e449857db3eec5e0e9701ba ]

Clearing HCI_UART_PROTO_READY will avoid usage of proto function pointers
before running the proto close function pointer. There is chance of kernel
crash, due to usage of non proto close function pointers after proto close.

Signed-off-by: Balakrishna Godavarthi &lt;bgodavar@codeaurora.org&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: hci_serdev: Init hci_uart proto_lock to avoid oops</title>
<updated>2018-08-15T16:12:49+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2017-11-16T23:54:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4a53c4e84ace1bc75157a7281af3fe8f5b19d08c'/>
<id>urn:sha1:4a53c4e84ace1bc75157a7281af3fe8f5b19d08c</id>
<content type='text'>
commit d73e172816652772114827abaa2dbc053eecbbd7 upstream.

John Stultz reports a boot time crash with the HiKey board (which uses
hci_serdev) occurring in hci_uart_tx_wakeup().  That function is
contained in hci_ldisc.c, but also called from the newer hci_serdev.c.
It acquires the proto_lock in struct hci_uart and it turns out that we
forgot to init the lock in the serdev code path, thus causing the crash.

John bisected the crash to commit 67d2f8781b9f ("Bluetooth: hci_ldisc:
Allow sleeping while proto locks are held"), but the issue was present
before and the commit merely exposed it.  (Perhaps by luck, the crash
did not occur with rwlocks.)

Init the proto_lock in the serdev code path to avoid the oops.

Stack trace for posterity:

Unable to handle kernel read from unreadable memory at 406f127000
[000000406f127000] user address but active_mm is swapper
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Hardware name: HiKey Development Board (DT)
Call trace:
 hci_uart_tx_wakeup+0x38/0x148
 hci_uart_send_frame+0x28/0x38
 hci_send_frame+0x64/0xc0
 hci_cmd_work+0x98/0x110
 process_one_work+0x134/0x330
 worker_thread+0x130/0x468
 kthread+0xf8/0x128
 ret_from_fork+0x10/0x18

Link: https://lkml.org/lkml/2017/11/15/908
Reported-and-tested-by: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Ronald Tschalär &lt;ronald@innovation.ch&gt;
Cc: Rob Herring &lt;rob.herring@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Amit Pundir &lt;amit.pundir@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()</title>
<updated>2017-07-20T09:18:36+00:00</updated>
<author>
<name>Ian Molton</name>
<email>ian@mnementh.co.uk</email>
</author>
<published>2017-07-08T16:37:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c34dc3bfa7642fda423208579015d615f7becfa0'/>
<id>urn:sha1:c34dc3bfa7642fda423208579015d615f7becfa0</id>
<content type='text'>
Several drivers have the same (and incorrect) code in their
_remove() handler.

Coalesce this into a shared function.

Signed-off-by: Ian Molton &lt;ian@mnementh.co.uk&gt;
Reviewed-by: Sebastian Reichel &lt;sebastian.reichel@collabora.co.uk&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_serdev: make hci_serdev_client_ops static</title>
<updated>2017-06-23T08:49:11+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2017-06-23T08:37:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=640e32c9ee55a7938eb7d629a87f46a94f77a87f'/>
<id>urn:sha1:640e32c9ee55a7938eb7d629a87f46a94f77a87f</id>
<content type='text'>
The structure hci_serdev_client_ops does not need to be in global scope
and is not modified, so make it static.

Cleans up sparse warning:
"symbol 'hci_serdev_client_ops' was not declared. Should it be static?"

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_serdev: allow modular drivers</title>
<updated>2017-04-12T20:12:17+00:00</updated>
<author>
<name>Sebastian Reichel</name>
<email>sre@kernel.org</email>
</author>
<published>2017-03-28T15:59:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=081f36a8c2e0ae56f33ba6b12389b290a49b6508'/>
<id>urn:sha1:081f36a8c2e0ae56f33ba6b12389b290a49b6508</id>
<content type='text'>
For bluetooth protocol driver only supporting serdev it makes
sense to follow common practice and built them into their own
module.

Such modules need access to hci_uart_register_device and
hci_uart_tx_wakeup for using the common protocol helpers.

Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_serdev: do not open device in hci open</title>
<updated>2017-04-12T20:12:17+00:00</updated>
<author>
<name>Sebastian Reichel</name>
<email>sre@kernel.org</email>
</author>
<published>2017-03-28T15:59:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=52b318e6196169e5ff8a52371833cd5a9dba05d1'/>
<id>urn:sha1:52b318e6196169e5ff8a52371833cd5a9dba05d1</id>
<content type='text'>
The device driver may need to communicate with the UART
device while the Bluetooth device is closed (e.g. due
to interrupts).

Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: add serdev driver support library</title>
<updated>2017-04-12T20:12:17+00:00</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2017-03-28T15:59:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=82f5169bf3d3b5d8f7f7c437d2d83435173cb638'/>
<id>urn:sha1:82f5169bf3d3b5d8f7f7c437d2d83435173cb638</id>
<content type='text'>
This adds library functions for serdev based BT drivers. This is largely
copied from hci_ldisc.c and modified to use serdev calls. There's a little
bit of duplication, but I avoided intermixing this as the ldisc code should
eventually go away.

Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Cc: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Cc: Johan Hedberg &lt;johan.hedberg@gmail.com&gt;
Cc: linux-bluetooth@vger.kernel.org
Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
[Fix style issues reported by Pavel]
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
</feed>
