Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
	}
}