android_kernel_motorola_sm6225/net/bluetooth
Dave Young 537d59af73 bluetooth: rfcomm_dev_state_change deadlock fix
There's logic in __rfcomm_dlc_close:
	rfcomm_dlc_lock(d);
	d->state = BT_CLOSED;
	d->state_changed(d, err);
	rfcomm_dlc_unlock(d);

In rfcomm_dev_state_change, it's possible that rfcomm_dev_put try to
take the dlc lock, then we will deadlock.

Here fixed it by unlock dlc before rfcomm_dev_get in
rfcomm_dev_state_change.

why not unlock just before rfcomm_dev_put? it's because there's
another problem.  rfcomm_dev_get/rfcomm_dev_del will take
rfcomm_dev_lock, but in rfcomm_dev_add the lock order is :
rfcomm_dev_lock --> dlc lock

so I unlock dlc before the taken of rfcomm_dev_lock.

Actually it's a regression caused by commit
1905f6c736 ("bluetooth :
__rfcomm_dlc_close lock fix"), the dlc state_change could be two
callbacks : rfcomm_sk_state_change and rfcomm_dev_state_change. I
missed the rfcomm_sk_state_change that time.

Thanks Arjan van de Ven <arjan@linux.intel.com> for the effort in
commit 4c8411f8c1 ("bluetooth: fix
locking bug in the rfcomm socket cleanup handling") but he missed the
rfcomm_dev_state_change lock issue.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-06-03 14:27:17 -07:00
..
bnep bluetooth: use get/put_unaligned_* helpers 2008-05-02 16:25:46 -07:00
cmtp [BLUETOOTH]: Use sockfd_put() 2008-01-28 15:00:48 -08:00
hidp bluetooth: uninlining 2008-02-05 03:07:58 -08:00
rfcomm bluetooth: rfcomm_dev_state_change deadlock fix 2008-06-03 14:27:17 -07:00
af_bluetooth.c bluetooth : use lockdep sub-classes for diffrent bluetooth protocol 2008-04-01 23:58:35 -07:00
hci_conn.c bluetooth: put hci dev after del conn 2008-02-18 20:44:01 -08:00
hci_core.c bluetooth: hci_core: defer hci_unregister_sysfs() 2008-03-05 18:45:59 -08:00
hci_event.c bluetooth: use get/put_unaligned_* helpers 2008-05-02 16:25:46 -07:00
hci_sock.c bluetooth: use get/put_unaligned_* helpers 2008-05-02 16:25:46 -07:00
hci_sysfs.c bluetooth: do not move child device other than rfcomm 2008-02-18 20:45:41 -08:00
Kconfig [S390] Kconfig: unwanted menus for s390. 2007-05-10 15:46:07 +02:00
l2cap.c bluetooth: use get/put_unaligned_* helpers 2008-05-02 16:25:46 -07:00
lib.c [NET] BLUETOOTH: Fix whitespace errors. 2007-02-10 23:19:20 -08:00
Makefile
sco.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-02 22:35:23 -07:00