From: Marcel Holtmann <marcel@holtmann.org>
To: Bing Zhao <bzhao@marvell.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: bluetooth: module_refcount is not decreased when connection times out
Date: Fri, 08 May 2009 16:27:19 -0700 [thread overview]
Message-ID: <1241825239.4903.71.camel@localhost.localdomain> (raw)
In-Reply-To: <477F20668A386D41ADCC57781B1F704301E62956E5@SC-VEXCH1.marvell.com>
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
Hi Bing,
> The module refcount is increased by hci_dev_hold() call in hci_conn_add() in hci_conn.c, and it is decreased by hci_dev_put() call in "del_conn" (hci_sysfs.c).
>
> In case connection timeout happens, hci_dev_put() is never called.
can you test the attached patch for quickly. It should fix it.
Regards
Marcel
[-- Attachment #2: patch-fix-hci-dev-refcount --]
[-- Type: text/x-patch, Size: 975 bytes --]
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 61309b2..85a1c6b 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -292,6 +292,8 @@ int hci_conn_del(struct hci_conn *conn)
hci_conn_del_sysfs(conn);
+ hci_dev_put(hdev);
+
return 0;
}
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index a05d45e..cd84cd4 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -99,6 +99,8 @@ static void add_conn(struct work_struct *work)
BT_ERR("Failed to register connection device");
return;
}
+
+ hci_dev_hold(hdev);
}
/*
@@ -120,7 +122,7 @@ static void del_conn(struct work_struct *work)
flush_work(&conn->work_add);
if (!device_is_registered(&conn->dev))
- return;
+ goto done;
while (1) {
struct device *dev;
@@ -134,6 +136,8 @@ static void del_conn(struct work_struct *work)
device_del(&conn->dev);
put_device(&conn->dev);
+
+done:
hci_dev_put(hdev);
}
next prev parent reply other threads:[~2009-05-08 23:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 22:59 bluetooth: module_refcount is not decreased when connection times out Bing Zhao
2009-05-08 23:20 ` Marcel Holtmann
2009-05-08 23:27 ` Marcel Holtmann [this message]
2009-05-09 0:01 ` Bing Zhao
2009-05-09 0:03 ` Marcel Holtmann
2009-05-09 1:08 ` Bing Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1241825239.4903.71.camel@localhost.localdomain \
--to=marcel@holtmann.org \
--cc=bzhao@marvell.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox