skb_padto length wrong when nonlinear
From: Leech, Christopher <hidden>
Date: 2003-01-16 23:54:59
The recently introduced skb_padto calculates the size of an sk_buff as skb->len + skb->data_len. My understanding was that the total length is in fact skb->len, and the linear portion needs to be calculated as skb->len - skb->data_len (as done by skb_headlen). It looks like skb_padto could mistakenly fail to linearize and 0-pad a buffer when (skb->len < len) && (skb->len + skb->data_len >= len). I realize this is an unlikely situation, but for the sake of correctness. - Chris Leech diff -ur linux-2.5/include/linux/skbuff.h b/include/linux/skbuff.h
--- linux-2.5/include/linux/skbuff.h 2003-01-13 12:45:20.000000000 -0800
+++ b/include/linux/skbuff.h 2003-01-16 15:02:20.000000000 -0800@@ -1102,7 +1102,7 @@ static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int
len)
{
- unsigned int size = skb->len + skb->data_len;
+ unsigned int size = skb->len;
if (likely(size >= len))
return skb;
return skb_pad(skb, len-size);