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

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

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 <>
Signed-off-by: default avatarEric Dumazet <>
Signed-off-by: default avatarDavid S. Miller <>
parent 46b3a421
......@@ -1809,6 +1809,8 @@ static inline void skb_orphan(struct sk_buff *skb)
skb->destructor = NULL;
skb->sk = NULL;
} else {
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