**/
 static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
 {
+       struct sk_buff *skb = adapter->ptp_tx_skb;
        struct e1000_hw *hw = &adapter->hw;
        struct skb_shared_hwtstamps shhwtstamps;
        u64 regval;
        shhwtstamps.hwtstamp =
                ktime_add_ns(shhwtstamps.hwtstamp, adjust);
 
-       skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps);
-       dev_kfree_skb_any(adapter->ptp_tx_skb);
+       /* Clear the lock early before calling skb_tstamp_tx so that
+        * applications are not woken up before the lock bit is clear. We use
+        * a copy of the skb pointer to ensure other threads can't change it
+        * while we're notifying the stack.
+        */
        adapter->ptp_tx_skb = NULL;
        clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
+
+       /* Notify the stack and free the skb after we've unlocked */
+       skb_tstamp_tx(skb, &shhwtstamps);
+       dev_kfree_skb_any(skb);
 }
 
 /**