This patch is originally from Doron Keren <doronkeren@ti.com>
http://www.spinics.net/lists/linux-bluetooth/msg15564.html . Original
description:
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.
BUG=chromium:228937
TEST=The following used to cause a panic reliably, but now doesn't:
- have Apple Magic Trackpad connected and working
- sleep/wake computer
- immediately click/rub fingers on trackpad
Change-Id: I63e0e37afe572641d7bda593887d2e3269043b5a
Signed-off-by: Ilia Kolominsky <iliak@ti.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/47653
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
+static int acl_conn_index;
static struct class *bt_class;
struct dentry *bt_debugfs;
BT_DBG("conn %p", conn);
- 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);
if (device_add(&conn->dev) < 0) {
BT_ERR("Failed to register connection device");