Return-Path: Subject: Re: [PATCH] Bluetooth-next: Add incremental indexing in sysfs HCI connection name. From: Marcel Holtmann To: doron.keren.bluez@gmail.com Cc: linux-bluetooth@vger.kernel.org, Doron Keren , Ilia Kolominsky Date: Wed, 17 Aug 2011 14:42:06 -0700 In-Reply-To: <1313596884-8733-1-git-send-email-doronkeren@ti.com> References: <1313596884-8733-1-git-send-email-doronkeren@ti.com> Content-Type: text/plain; charset="UTF-8" Message-ID: <1313617329.3373.188.camel@aeonflux> Mime-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Doron, > 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 > --- > 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 > #include > > +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); can we get a bit more of details on what this is actually trying to solve. I do not like this way of solving it at all. I think it is trying to cover up symptoms and not fixing the real issue. Regards Marcel