Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310410
b: refs/heads/master
c: cc9b17a
h: refs/heads/master
v: v3
  • Loading branch information
Jason Wang authored and David S. Miller committed May 31, 2012
1 parent 0aaee37 commit 91cfc36
Show file tree
Hide file tree
Showing 2 changed files with 6 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: 914bec1011a25f65cdc94988a6f974bfb9a3c10d
refs/heads/master: cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc
7 changes: 5 additions & 2 deletions trunk/net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,11 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
gfp_t gfp_mask;
long timeo;
int err;
int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;

err = -EMSGSIZE;
if (npages > MAX_SKB_FRAGS)
goto failure;

gfp_mask = sk->sk_allocation;
if (gfp_mask & __GFP_WAIT)
Expand All @@ -1610,14 +1615,12 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
skb = alloc_skb(header_len, gfp_mask);
if (skb) {
int npages;
int i;

/* No pages, we're done... */
if (!data_len)
break;

npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
skb->truesize += data_len;
skb_shinfo(skb)->nr_frags = npages;
for (i = 0; i < npages; i++) {
Expand Down

0 comments on commit 91cfc36

Please sign in to comment.