Skip to content

Commit

Permalink
net: BUG instead of corrupting memory in pskb_expand_head
Browse files Browse the repository at this point in the history
If the caller of pskb_expand_head specifies a negative nhead
we'll silently overwrite other people's memory.  This patch
makes it BUG instead.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 1, 2008
1 parent 12a169e commit 4edd87a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
#endif
long off;

BUG_ON(nhead < 0);

if (skb_shared(skb))
BUG();

Expand Down

0 comments on commit 4edd87a

Please sign in to comment.