netlink: don't orphan skb in netlink_trim()
authorPatrick McHardy <kaber@trash.net>
Wed, 17 Apr 2013 06:46:59 +0000 (06:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Apr 2013 18:57:57 +0000 (14:57 -0400)
Netlink doesn't account skbs to the sending socket, so the there's no
need to orphan the skb before trimming it.

Removing the skb_orphan() call is required for mmap'ed netlink, which uses
a netlink specific skb destructor that must not be invoked before the
final freeing of the skb.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c

index 978a61f7c87f19ec6f6e50ae8c75ecd83f114d4b..26779c24b1d4b276f667fb47d50feb0b5bdee21e 100644 (file)
@@ -851,7 +851,7 @@ static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
 {
        int delta;
 
-       skb_orphan(skb);
+       WARN_ON(skb->sk != NULL);
 
        delta = skb->end - skb->tail;
        if (delta * 2 < skb->truesize)