Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33345
b: refs/heads/master
c: e9fa4f7
h: refs/heads/master
i:
  33343: cca5cbe
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Aug 14, 2006
1 parent d10f909 commit 27e0a4d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 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: dcb7cd97f133f7cfbd181149a1e60215a869f895
refs/heads/master: e9fa4f7bd291c29a785666e2fa5a9cf3241ee6c3
15 changes: 15 additions & 0 deletions trunk/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,21 @@ static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
return (len < skb->len) ? __pskb_trim(skb, len) : 0;
}

/**
* pskb_trim_unique - remove end from a paged unique (not cloned) buffer
* @skb: buffer to alter
* @len: new length
*
* This is identical to pskb_trim except that the caller knows that
* the skb is not cloned so we should never get an error due to out-
* of-memory.
*/
static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
{
int err = pskb_trim(skb, len);
BUG_ON(err);
}

/**
* skb_orphan - orphan a buffer
* @skb: buffer to orphan
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ int ip_append_data(struct sock *sk,
skb_prev->csum = csum_sub(skb_prev->csum,
skb->csum);
data += fraggap;
skb_trim(skb_prev, maxfraglen);
pskb_trim_unique(skb_prev, maxfraglen);
}

copy = datalen - transhdrlen - fraggap;
Expand Down Expand Up @@ -1142,7 +1142,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
data, fraggap, 0);
skb_prev->csum = csum_sub(skb_prev->csum,
skb->csum);
skb_trim(skb_prev, maxfraglen);
pskb_trim_unique(skb_prev, maxfraglen);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/ip6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
skb_prev->csum = csum_sub(skb_prev->csum,
skb->csum);
data += fraggap;
skb_trim(skb_prev, maxfraglen);
pskb_trim_unique(skb_prev, maxfraglen);
}
copy = datalen - transhdrlen - fraggap;
if (copy < 0) {
Expand Down

0 comments on commit 27e0a4d

Please sign in to comment.