Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290988
b: refs/heads/master
c: e0edf37
h: refs/heads/master
v: v3
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Feb 20, 2012
1 parent c3ec719 commit 0c317df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7cc2ade2cbc6f71090f0f8d0e11cb68886ddc65e
refs/heads/master: e0edf3733fb62f91bbb8ec3fab4a90b0ac2dd037
18 changes: 14 additions & 4 deletions trunk/net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
{
struct sock *sk;
struct hlist_node *node;
struct sk_buff *skb_copy = NULL;

BT_DBG("hdev %p len %d", hdev, skb->len);

Expand Down Expand Up @@ -131,18 +132,27 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
continue;
}

nskb = skb_clone(skb, GFP_ATOMIC);
if (!skb_copy) {
/* Create a private copy with headroom */
skb_copy = __pskb_copy(skb, 1, GFP_ATOMIC);
if (!skb_copy)
continue;

/* Put type byte before the data */
memcpy(skb_push(skb_copy, 1), &bt_cb(skb)->pkt_type, 1);
}

nskb = skb_clone(skb_copy, GFP_ATOMIC);
if (!nskb)
continue;

/* Put type byte before the data */
memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1);

if (sock_queue_rcv_skb(sk, nskb))
kfree_skb(nskb);
}

read_unlock(&hci_sk_list.lock);

kfree_skb(skb_copy);
}

/* Send frame to control socket */
Expand Down

0 comments on commit 0c317df

Please sign in to comment.