linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix memory leak at end of hci requests
@ 2016-08-21 12:25 Frédéric Dalleau
  0 siblings, 0 replies; only message in thread
From: Frédéric Dalleau @ 2016-08-21 12:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frederic Dalleau

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-21 12:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-21 12:25 [PATCH] Bluetooth: Fix memory leak at end of hci requests Frédéric Dalleau

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).