Commit 376c7311 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: add a temporary sanity check in skb_orphan()

David suggested to add a BUG_ON() to catch if some layer
sets skb->sk pointer without a corresponding destructor.

As skb can sit in a queue, it's mandatory to make sure the
socket cannot disappear, and it's usually done by taking a
reference on the socket, then releasing it from the skb
destructor.

This patch is a follow-up to commit c34a7612
("net: skb_orphan() changes") and will be reverted after
catching all possible offenders if any.
Suggested-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46b3a421
......@@ -1809,6 +1809,8 @@ static inline void skb_orphan(struct sk_buff *skb)
skb->destructor(skb);
skb->destructor = NULL;
skb->sk = NULL;
} else {
BUG_ON(skb->sk);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment