From: Govindarajulu Varadarajan <gvara...@cisco.com>
Date: Fri,  1 Dec 2017 10:21:40 -0800

> Add ethtool ops to advertise sw timestamping.
> Call skb_tx_timestamp() just before ringing the wq doorbell.
> 
> Signed-off-by: Govindarajulu Varadarajan <gvara...@cisco.com>
...
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c 
> b/drivers/net/ethernet/cisco/enic/enic_main.c
> index e130fb757e7b..d98676e43e03 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
> @@ -856,6 +856,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff 
> *skb,
>  
>       if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
>               netif_tx_stop_queue(txq);
> +     skb_tx_timestamp(skb);
>       if (!skb->xmit_more || netif_xmit_stopped(txq))
>               vnic_wq_doorbell(wq);
>  

Applied, but if you even make this queue processing code lockless you will
have a use-after-free here as you're placing the SKB into the TX queue
before accessing the 'skb' via skb_tx_timestamp() and it thus could be
freed by TX completion beforehand.

Reply via email to