Re: BT git version triggers BUG: scheduling while atomic: swapper/0/0x10000100

Marcel Holtmann
2009-05-05T01:56:53Z

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

Hi Hugo,

> > > When I tried to get a mobile phone connected to asterisk via bluetooth,
> > > the current git version of the linux bluetooth stack triggers a kernel
> > > bug:
> > >
> > > BUG: scheduling while atomic: swapper/0/0x10000100
> > >
> > > This is triggered the moment when asterisk tries to pair the phone and
> > > leaves at least the BT subsystem in an unusable state.
> >
> > are you running Linus' tree or bluetooth-testing.git? If your are not
> > running bluetooth-testing.git, then please try that one since it
> > includes a fix for it.
>
> I'm running bluetooth-testing.git and pulled that tree just an hour ago.

does the attached patch fixes your issue?

Regards

Marcel

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 919 bytes --]

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 582d887..a05d45e 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -88,10 +88,13 @@ static struct device_type bt_link = {
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;

/* ensure previous del is complete */
flush_work(&conn->work_del);

+ dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
+
if (device_add(&conn->dev) < 0) {
BT_ERR("Failed to register connection device");
return;
@@ -154,12 +157,8 @@ void hci_conn_init_sysfs(struct hci_conn *conn)

void hci_conn_add_sysfs(struct hci_conn *conn)
{
- struct hci_dev *hdev = conn->hdev;
-
BT_DBG("conn %p", conn);

- dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
-
queue_work(bt_workq, &conn->work_add);
}