Bluetooth: hci_uart: Fix zero len data packet reception issue
authorLoic Poulain <loic.poulain@intel.com>
Mon, 24 Aug 2015 16:57:57 +0000 (18:57 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 28 Aug 2015 19:00:37 +0000 (21:00 +0200)
Packets with a variable length value equal to zero were not received.

Since no more data expected (and input buffer entirely consumed), we
need to complete/forward the packet immediately instead of waiting for
more data.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_h4.c

index 57faddc53645a33fdb7e9e334ffddbadd7c1cb98..eec3f28e4bb9ffba89498a19e16e3a3320a164f2 100644 (file)
@@ -223,8 +223,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                        switch ((&pkts[i])->lsize) {
                        case 0:
                                /* No variable data length */
-                               (&pkts[i])->recv(hdev, skb);
-                               skb = NULL;
+                               dlen = 0;
                                break;
                        case 1:
                                /* Single octet variable length */
@@ -252,6 +251,12 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                                kfree_skb(skb);
                                return ERR_PTR(-EILSEQ);
                        }
+
+                       if (!dlen) {
+                               /* No more data, complete frame */
+                               (&pkts[i])->recv(hdev, skb);
+                               skb = NULL;
+                       }
                } else {
                        /* Complete frame */
                        (&pkts[i])->recv(hdev, skb);