# Re: \[PATCH net-next\] net: bail on sock\_wfree, sock\_rfree when we have a TCP\_TIMEWAIT sk

- From: Julian Anastasov \<ja@ssi.bg\>
- Date: 2015-07-02 18:47:50 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/07/10991029
- Thread: https://ratatoskr.run/netdev/2015/07/10990993/t.md

```text

	Hello,

On Thu, 2 Jul 2015, Julian Anastasov wrote:

> 	Alex, in our discussion on January I thought
> we can skip calling skb_orphan for some cases but as
> input and output path use different skb->destructor
> we should call skb_orphan for every method, in every
> case when skb->dev != NULL, even when we do not call
> LOCAL_OUT, i.e. when NF_ACCEPT is returned for traffic
> to local real server. We should not call it only for
> local socket (skb->dev == NULL).
> 
> 	I think, your patch from January is almost
> good:
> 
> http://archive.linuxvirtualserver.org/html/lvs-devel/2015-01/msg00014.html
> 
> 	Just add skb->dev check and we should be fine.

	Sorry, I overlooked the problem. Above is not
correct because we can avoid the skb_orphan call
when 'local' is true. ip_vs_nat_send_or_cont should
call skb_orphan even for local=true while for TUN
it should be before ip_vs_prepare_tunneled_skb.
All other methods should avoid skb_orphan if
local=true or skb->dev is NULL.

Regards

--
Julian Anastasov [ref]
```
