net: Move rx skb_orphan call to where needed
commit172570a224fe66d560c097e48fca15b620c76e72
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Jun 2009 18:31:57 +0000 (26 11:31 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 16 Aug 2009 21:18:16 +0000 (16 14:18 -0700)
treeede2c24195a1522558066d373dd3adf0d4040886
parent7aa61b2706f362c31e1ad125f694e6ef5f4e2385
net: Move rx skb_orphan call to where needed

[ Upstream commit 329c44e3948473916bccd253a37ac2a66dad9862 ]

In order to get the tun driver to account packets, we need to be
able to receive packets with destructors set.  To be on the safe
side, I added an skb_orphan call for all protocols by default since
some of them (IP in particular) cannot handle receiving packets
destructors properly.

Now it seems that at least one protocol (CAN) expects to be able
to pass skb->sk through the rx path without getting clobbered.

So this patch attempts to fix this properly by moving the skb_orphan
call to where it's actually needed.  In particular, I've added it
to skb_set_owner_[rw] which is what most users of skb->destructor
call.

This is actually an improvement for tun too since it means that
we only give back the amount charged to the socket when the skb
is passed to another socket that will also be charged accordingly.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Oliver Hartkopp <olver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/net/sctp/sctp.h
include/net/sock.h
net/ax25/ax25_in.c
net/core/dev.c
net/irda/af_irda.c
net/irda/ircomm/ircomm_lmp.c