android_kernel_xiaomi_sm8350/net/bluetooth
Marcel Holtmann a67e899cf3 Bluetooth: Fix issue with sysfs handling for connections
Due to a semantic changes in flush_workqueue() the current approach of
synchronizing the sysfs handling for connections doesn't work anymore. The
whole approach is actually fully broken and based on assumptions that are
no longer valid.

With the introduction of Simple Pairing support, the creation of low-level
ACL links got changed. This change invalidates the reason why in the past
two independent work queues have been used for adding/removing sysfs
devices. The adding of the actual sysfs device is now postponed until the
host controller successfully assigns an unique handle to that link. So
the real synchronization happens inside the controller and not the host.

The only left-over problem is that some internals of the sysfs device
handling are not initialized ahead of time. This leaves potential access
to invalid data and can cause various NULL pointer dereferences. To fix
this a new function makes sure that all sysfs details are initialized
when an connection attempt is made. The actual sysfs device is only
registered when the connection has been successfully established. To
avoid a race condition with the registration, the check if a device is
registered has been moved into the removal work.

As an extra protection two flush_work() calls are left in place to
make sure a previous add/del work has been completed first.

Based on a report by Marc Pignat <marc.pignat@hevs.ch>

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Tested-by: Justin P. Mattock <justinmattock@gmail.com>
Tested-by: Roger Quadros <ext-roger.quadros@nokia.com>
Tested-by: Marc Pignat <marc.pignat@hevs.ch>
2009-05-04 14:29:02 -07:00
..
bnep
cmtp Bluetooth: Remove some pointless conditionals before kfree_skb() 2009-02-27 06:14:49 +01:00
hidp
rfcomm Bluetooth: Fix removing of RFCOMM DLC timer with DEFER_SETUP 2009-04-19 18:56:45 +02:00
af_bluetooth.c Bluetooth: Fix poll() misbehavior when using BT_DEFER_SETUP 2009-02-27 06:14:46 +01:00
hci_conn.c Bluetooth: Fix issue with sysfs handling for connections 2009-05-04 14:29:02 -07:00
hci_core.c Bluetooth: Remove some pointless conditionals before kfree_skb() 2009-02-27 06:14:49 +01:00
hci_event.c Bluetooth: Add different pairing timeout for Legacy Pairing 2009-04-28 09:31:38 -07:00
hci_sock.c
hci_sysfs.c Bluetooth: Fix issue with sysfs handling for connections 2009-05-04 14:29:02 -07:00
Kconfig
l2cap.c Bluetooth: Remove some pointless conditionals before kfree_skb() 2009-02-27 06:14:49 +01:00
lib.c
Makefile
sco.c Bluetooth: Ask upper layers for HCI disconnect reason 2009-02-27 06:14:43 +01:00