diff options
author | Jaganath Kanakkassery <jaganath.k.os@gmail.com> | 2017-10-25 01:28:48 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2017-10-29 09:07:10 -0400 |
commit | f17d858ed0a48270db4368d8cf370e3839ee6f4f (patch) | |
tree | 975b67fd9b1bf35c27320b25f11b8fa508d69a12 /net/bluetooth/hci_request.c | |
parent | 858ff38af77fc660092e82474ecc6ac135ed29fe (diff) |
Bluetooth: Fix potential memory leak
If command is added to req then it should be freed in case if
hdev is down or HCI_ADVERTISING flag is set.
This introduces a helper in hci_request to purge the cmd_q
to make cmd_q internal to hci_request which is used to fix
the leak.
This also replace accessing of cmd_q in hci_conn with the
new helper.
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r-- | net/bluetooth/hci_request.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index b73ac149de34..7f28d17dc792 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -41,6 +41,11 @@ void hci_req_init(struct hci_request *req, struct hci_dev *hdev) | |||
41 | req->err = 0; | 41 | req->err = 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | void hci_req_purge(struct hci_request *req) | ||
45 | { | ||
46 | skb_queue_purge(&req->cmd_q); | ||
47 | } | ||
48 | |||
44 | static int req_run(struct hci_request *req, hci_req_complete_t complete, | 49 | static int req_run(struct hci_request *req, hci_req_complete_t complete, |
45 | hci_req_complete_skb_t complete_skb) | 50 | hci_req_complete_skb_t complete_skb) |
46 | { | 51 | { |