From: "Frédéric Dalleau" <frederic.dalleau@collabora.co.uk>
To: linux-bluetooth@vger.kernel.org
Cc: Frederic Dalleau <frederic.dalleau@collabora.co.uk>
Subject: [PATCH] Bluetooth: Fix memory leak at end of hci requests
Date: Sun, 21 Aug 2016 14:25:31 +0200 [thread overview]
Message-ID: <1471782331-3755-1-git-send-email-frederic.dalleau@collabora.co.uk> (raw)
From: Frederic Dalleau <frederic.dalleau@collabora.co.uk>
hci_req_sync_complete takes a reference on the skb in hdev->req_skb.
It is called (via hci_req_run_skb) from either __hci_cmd_sync_ev which will
pass the skb to the caller, or __hci_req_sync which leaks.
Signed-off-by: Frédéric Dalleau <frederic.dalleau@collabora.co.uk>
---
net/bluetooth/hci_request.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index c045b3c..7a5f9ed 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -212,6 +212,10 @@ int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
set_current_state(TASK_INTERRUPTIBLE);
err = hci_req_run_skb(&req, hci_req_sync_complete);
+
+ kfree_skb(hdev->req_skb);
+ hdev->req_skb = NULL;
+
if (err < 0) {
hdev->req_status = 0;
--
2.7.4
reply other threads:[~2016-08-21 12:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1471782331-3755-1-git-send-email-frederic.dalleau@collabora.co.uk \
--to=frederic.dalleau@collabora.co.uk \
--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;
as well as URLs for NNTP newsgroup(s).