Bluetooth: Queue diagnostic messages together with HCI packets
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 9 Oct 2015 14:13:51 +0000 (16:13 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 20 Oct 2015 22:49:21 +0000 (00:49 +0200)
Sending diagnostic messages directly to the monitor socket might cause
issues for devices processing their messages in interrupt context. So
instead of trying to directly forward them, queue them up with the other
HCI packets and lets them be processed by the sockets at the same time.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_core.c

index e4e53bd663dfb2392f912cc3b92f11dfb213ee55..b36a2e5693d23a6993ef9cd3557b5a38488852b4 100644 (file)
@@ -3555,14 +3555,15 @@ EXPORT_SYMBOL(hci_recv_frame);
 /* Receive diagnostic message from HCI drivers */
 int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb)
 {
+       /* Mark as diagnostic packet */
+       bt_cb(skb)->pkt_type = HCI_DIAG_PKT;
+
        /* Time stamp */
        __net_timestamp(skb);
 
-       /* Mark as diagnostic packet and send to monitor */
-       bt_cb(skb)->pkt_type = HCI_DIAG_PKT;
-       hci_send_to_monitor(hdev, skb);
+       skb_queue_tail(&hdev->rx_q, skb);
+       queue_work(hdev->workqueue, &hdev->rx_work);
 
-       kfree_skb(skb);
        return 0;
 }
 EXPORT_SYMBOL(hci_recv_diag);