Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266647
b: refs/heads/master
c: 5b668eb
h: refs/heads/master
i:
  266645: 2574c9b
  266643: 0a55de1
  266639: 3045fed
v: v3
  • Loading branch information
Mat Martineau authored and Gustavo F. Padovan committed Sep 27, 2011
1 parent eccba29 commit deddf24
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 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: 449357200c5d73d80a9c42dee5dafed684b3cd17
refs/heads/master: 5b668eb3270f3f9c13ddf6e4fb57bf20c83dccff
30 changes: 28 additions & 2 deletions trunk/net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
}

chunk = min_t(unsigned int, skb->len, size);
if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
if (skb_copy_datagram_iovec(skb, 0, msg->msg_iov, chunk)) {
skb_queue_head(&sk->sk_receive_queue, skb);
if (!copied)
copied = -EFAULT;
Expand All @@ -361,7 +361,33 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
sock_recv_ts_and_drops(msg, sk, skb);

if (!(flags & MSG_PEEK)) {
skb_pull(skb, chunk);
int skb_len = skb_headlen(skb);

if (chunk <= skb_len) {
__skb_pull(skb, chunk);
} else {
struct sk_buff *frag;

__skb_pull(skb, skb_len);
chunk -= skb_len;

skb_walk_frags(skb, frag) {
if (chunk <= frag->len) {
/* Pulling partial data */
skb->len -= chunk;
skb->data_len -= chunk;
__skb_pull(frag, chunk);
break;
} else if (frag->len) {
/* Pulling all frag data */
chunk -= frag->len;
skb->len -= frag->len;
skb->data_len -= frag->len;
__skb_pull(frag, frag->len);
}
}
}

if (skb->len) {
skb_queue_head(&sk->sk_receive_queue, skb);
break;
Expand Down

0 comments on commit deddf24

Please sign in to comment.