linux/include/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
..
bluetooth.h Bluetooth: Add enhanced security model for Simple Pairing 2009-02-27 06:14:25 +01:00
hci_core.h Bluetooth: Fix issue with sysfs handling for connections 2009-05-04 14:29:02 -07:00
hci.h Bluetooth: Add different pairing timeout for Legacy Pairing 2009-04-28 09:31:38 -07:00
l2cap.h Bluetooth: Ask upper layers for HCI disconnect reason 2009-02-27 06:14:43 +01:00
rfcomm.h Bluetooth: Pause RFCOMM TX when encryption drops 2009-02-27 06:14:33 +01:00
sco.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00