[NET]: Add skb->truesize assertion checking.
Add some sanity checking. truesize should be at least sizeof(struct sk_buff) plus the current packet length. If not, then truesize is seriously mangled and deserves a kernel log message. Currently we'll do the check for release of stream socket buffers. But we can add checks to more spots over time. Incorporating ideas from Herbert Xu. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@ -454,6 +454,7 @@ static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk)
|
||||
|
||||
static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
skb_truesize_check(skb);
|
||||
sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
|
||||
sk->sk_wmem_queued -= skb->truesize;
|
||||
sk->sk_forward_alloc += skb->truesize;
|
||||
|
Reference in New Issue
Block a user