igb: Free any held skb that should have been timestamped on remove
authorMatthew Vick <matthew.vick@intel.com>
Thu, 13 Dec 2012 07:20:37 +0000 (07:20 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 18 Jan 2013 12:58:15 +0000 (04:58 -0800)
To prevent a race condition where an skb has been saved to return the Tx
timestamp later and the driver is removed, add a check to determine if we
have an skb stored and, if so, free it.

Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Acked-by: Jacob Keller <Jacob.e.keller@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/igb_ptp.c

index 2ec53d7ca1b7d54b364378be7460dadd6209c74d..09f61a4a951ff17f1a8f225c76fa44226342ea8e 100644 (file)
@@ -856,6 +856,10 @@ void igb_ptp_stop(struct igb_adapter *adapter)
        }
 
        cancel_work_sync(&adapter->ptp_tx_work);
+       if (adapter->ptp_tx_skb) {
+               dev_kfree_skb_any(adapter->ptp_tx_skb);
+               adapter->ptp_tx_skb = NULL;
+       }
 
        if (adapter->ptp_clock) {
                ptp_clock_unregister(adapter->ptp_clock);