Bluetooth: Add extra device reference counting for connections
commit34976a3ca81f3f5a250ba6074bda0848e97cf2e9
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 22 Aug 2009 21:19:26 +0000 (22 14:19 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Oct 2009 22:11:53 +0000 (22 15:11 -0700)
tree77184c6300800ff41f9cc9017893d0be5a4d6710
parente6b29924d809c3e9e66e550c032f3cc6a3d39d6f
Bluetooth: Add extra device reference counting for connections

commit 9eba32b86d17ef87131fa0bce43c614904ab5781 upstream.

The device model itself has no real usable reference counting at the
moment and this causes problems if parents are deleted before their
children. The device model itself handles the memory details of this
correctly, but the uevent order is not consistent. This causes various
problems for systems like HAL or even X.

So until device_put() does a proper cleanup, the device for Bluetooth
connection will be protected with an extra reference counting to ensure
the correct order of uevents when connections are terminated.

This is not an automatic feature. Higher Bluetooth layers like HIDP or
BNEP should grab this new reference to ensure that their uevents are
send before the ones from the parent device.

Based on a report by Brian Rogers <brian@xyzw.org>

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_conn.c
net/bluetooth/hci_event.c