# Re: \[PATCH net-next 1/9\] openvswitch: Scrub packet in ovs\_vport\_receive()

- From: Hannes Frederic Sowa \<hidden\>
- Date: 2015-07-31 14:35:02 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/07/4547733
- Thread: https://ratatoskr.run/netdev/2015/07/4547037/t.md

```text
On Thu, 2015-07-30 at 11:12 -0700, Joe Stringer wrote:
> Signed-off-by: Joe Stringer <redacted>
> ---
>  net/openvswitch/vport.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index d14f594..baa018f 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -475,6 +475,9 @@ void ovs_vport_receive(struct vport *vport, struct 
> sk_buff *skb,
>  	struct sw_flow_key key;
>  	int error;
>  
> +	if (!skb->sk || (sock_net(skb->sk) != read_pnet(&vport->dp
> ->net)))
> +		skb_scrub_packet(skb, true);
> +
>  	stats = this_cpu_ptr(vport->percpu_stats);
>  	u64_stats_update_begin(&stats->syncp);
>  	stats->rx_packets++;

In general, this shouldn't be necessary as the packet should already be
scrubbed before they arrive here.

Could you maybe add a WARN_ON and check how those skbs with conntrack
data traverse the stack? I also didn't understand why make it dependent
on the socket.

Thanks,
Hannes
```
