All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_h4: Fix zero len data packet reception issue
@ 2015-08-24 16:57 Loic Poulain
  2015-08-24 18:19 ` Marcel Holtmann
  2015-08-25 15:02 ` Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Loic Poulain @ 2015-08-24 16:57 UTC (permalink / raw)
  To: marcel, johan.hedberg; +Cc: linux-bluetooth, Loic Poulain

Packets with a variable len 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.

Fix this by completing the packet on !dlen.
happening if two cases:
    - no variable data len
    - variable data len is zero.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
---
 drivers/bluetooth/hci_h4.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index 57faddc..5bd8301 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-25 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 16:57 [PATCH] Bluetooth: hci_h4: Fix zero len data packet reception issue Loic Poulain
2015-08-24 18:19 ` Marcel Holtmann
2015-08-25  8:09   ` Loic Poulain
2015-08-25 15:01     ` Marcel Holtmann
2015-08-25 15:02 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.