1
0
Fork 0

net: BUG instead of corrupting memory in pskb_expand_head

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>
hifive-unleashed-5.1
Herbert Xu 2008-10-01 07:09:38 -07:00 committed by David S. Miller
parent 12a169e7d8
commit 4edd87ad5c
1 changed files with 2 additions and 0 deletions

View File

@ -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();