diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 3 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 12 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 0e7ee892d7ab..89eda2ef2380 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -244,6 +244,7 @@ struct hci_dev { | |||
244 | struct sk_buff_head raw_q; | 244 | struct sk_buff_head raw_q; |
245 | struct sk_buff_head cmd_q; | 245 | struct sk_buff_head cmd_q; |
246 | 246 | ||
247 | struct sk_buff *recv_evt; | ||
247 | struct sk_buff *sent_cmd; | 248 | struct sk_buff *sent_cmd; |
248 | struct sk_buff *reassembly[NUM_REASSEMBLY]; | 249 | struct sk_buff *reassembly[NUM_REASSEMBLY]; |
249 | 250 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index a199d631e31c..7c323bd112ff 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1136,6 +1136,9 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
1136 | hdev->sent_cmd = NULL; | 1136 | hdev->sent_cmd = NULL; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | kfree_skb(hdev->recv_evt); | ||
1140 | hdev->recv_evt = NULL; | ||
1141 | |||
1139 | /* After this point our queues are empty | 1142 | /* After this point our queues are empty |
1140 | * and no tasks are scheduled. */ | 1143 | * and no tasks are scheduled. */ |
1141 | hdev->close(hdev); | 1144 | hdev->close(hdev); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 7e7fbca59439..ed0efb7255b0 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3699,6 +3699,18 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
3699 | struct hci_event_hdr *hdr = (void *) skb->data; | 3699 | struct hci_event_hdr *hdr = (void *) skb->data; |
3700 | __u8 event = hdr->evt; | 3700 | __u8 event = hdr->evt; |
3701 | 3701 | ||
3702 | hci_dev_lock(hdev); | ||
3703 | |||
3704 | /* Received events are (currently) only needed when a request is | ||
3705 | * ongoing so avoid unnecessary memory allocation. | ||
3706 | */ | ||
3707 | if (hdev->req_status == HCI_REQ_PEND) { | ||
3708 | kfree_skb(hdev->recv_evt); | ||
3709 | hdev->recv_evt = skb_clone(skb, GFP_KERNEL); | ||
3710 | } | ||
3711 | |||
3712 | hci_dev_unlock(hdev); | ||
3713 | |||
3702 | skb_pull(skb, HCI_EVENT_HDR_SIZE); | 3714 | skb_pull(skb, HCI_EVENT_HDR_SIZE); |
3703 | 3715 | ||
3704 | switch (event) { | 3716 | switch (event) { |