All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth-next: Add incremental indexing in sysfs HCI connection name.
@ 2011-08-17 16:01 doron.keren.bluez
  2011-08-17 21:42 ` Marcel Holtmann
  0 siblings, 1 reply; 9+ messages in thread
From: doron.keren.bluez @ 2011-08-17 16:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Doron Keren, Ilia Kolominsky

From: Doron Keren <doronkeren@ti.com>

The patch fixes kernel panic which is due to race condition
between the setup of incomming connection and clean-up of the
dead one. Observed in the following case: attached HID device
disconnects unexpectedly (without performing ACL disconnect ),
the device tries to connect again before the ACL link time-out
fires, this translates to the HCI_DISCONNECT, HCI_CONNECT_REQ
events on the same handle, since HCI_DISCONNECT trigers the clean
up of the HID device and handled in different context, the
linking/unlinking connection object to sysfs, may mess up.

Signed-off-by: Ilia Kolominsky <iliak@ti.com>
---
 net/bluetooth/hci_sysfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index a6c3aa8..5967d63 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -9,6 +9,7 @@
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
 
+static int acl_conn_index = 0;
 static struct class *bt_class;
 
 struct dentry *bt_debugfs;
@@ -91,7 +92,8 @@ static void add_conn(struct work_struct *work)
 	struct hci_conn *conn = container_of(work, struct hci_conn, work_add);
 	struct hci_dev *hdev = conn->hdev;
 
-	dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
+	acl_conn_index++;
+	dev_set_name(&conn->dev, "%s:%d:%d", hdev->name, conn->handle, acl_conn_index);
 
 	dev_set_drvdata(&conn->dev, conn);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-14 14:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 16:01 [PATCH] Bluetooth-next: Add incremental indexing in sysfs HCI connection name doron.keren.bluez
2011-08-17 21:42 ` Marcel Holtmann
2011-08-18 11:21   ` Keren, Doron
2011-08-18 11:44     ` David Herrmann
2011-08-23 15:47       ` Peter Hurley
2011-08-24 19:27         ` David Herrmann
2011-08-24 21:51           ` Peter Hurley
2011-08-25 17:11             ` David Herrmann
2011-09-14 14:42     ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.