浏览代码

Bluetooth: Fix packet size provided to the controller

When building fragmented skb's skb->len keeps track of the size of head
plus all fragments combined, however when queueing the skb for sending we
need to report the head size instead of the total size, so we just set
skb->len to skb_headlen().

This bug appeared when implementing MSG_MORE support for L2CAP sockets, it
never showed up before because l2cap_skbuff_fromiovec() never accounted skb
size correctly. A following patch will fix this.

Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Reviewed-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Gustavo Padovan 13 年之前
父节点
当前提交
087bfd99f7
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      net/bluetooth/hci_core.c

+ 6 - 2
net/bluetooth/hci_core.c

@@ -2162,6 +2162,12 @@ static void hci_queue_acl(struct hci_conn *conn, struct sk_buff_head *queue,
 	struct hci_dev *hdev = conn->hdev;
 	struct hci_dev *hdev = conn->hdev;
 	struct sk_buff *list;
 	struct sk_buff *list;
 
 
+	skb->len = skb_headlen(skb);
+	skb->data_len = 0;
+
+	bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
+	hci_add_acl_hdr(skb, conn->handle, flags);
+
 	list = skb_shinfo(skb)->frag_list;
 	list = skb_shinfo(skb)->frag_list;
 	if (!list) {
 	if (!list) {
 		/* Non fragmented */
 		/* Non fragmented */
@@ -2205,8 +2211,6 @@ void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags)
 	BT_DBG("%s chan %p flags 0x%x", hdev->name, chan, flags);
 	BT_DBG("%s chan %p flags 0x%x", hdev->name, chan, flags);
 
 
 	skb->dev = (void *) hdev;
 	skb->dev = (void *) hdev;
-	bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
-	hci_add_acl_hdr(skb, conn->handle, flags);
 
 
 	hci_queue_acl(conn, &chan->data_q, skb, flags);
 	hci_queue_acl(conn, &chan->data_q, skb, flags);