linux_dsm_epyc7002/drivers/net/ethernet/intel
Jacob Keller 5012863b73 e1000e: fix race condition around skb_tstamp_tx()
The e1000e driver and related hardware has a limitation on Tx PTP
packets which requires we limit to timestamping a single packet at once.
We do this by verifying that we never request a new Tx timestamp while
we still have a tx_hwtstamp_skb pointer.

Unfortunately the driver suffers from a race condition around this. The
tx_hwtstamp_skb pointer is not set to NULL until after skb_tstamp_tx()
is called. This function notifies the stack and applications of a new
timestamp. Even a well behaved application that only sends a new request
when the first one is finished might be woken up and possibly send
a packet before we can free the timestamp in the driver again. The
result is that we needlessly ignore some Tx timestamp requests in this
corner case.

Fix this by assigning the tx_hwtstamp_skb pointer prior to calling
skb_tstamp_tx() and use a temporary pointer to hold the timestamped skb
until that function finishes. This ensures that the application is not
woken up until the driver is ready to begin timestamping a new packet.

This ensures that well behaved applications do not accidentally race
with condition to skip Tx timestamps. Obviously an application which
sends multiple Tx timestamp requests at once will still only timestamp
one packet at a time. Unfortunately there is nothing we can do about
this.

Reported-by: David Mirabito <davidm@metamako.com>
Signed-off-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>
2017-06-06 00:52:17 -07:00
..
e1000 e1000: Omit private ndo_get_stats function 2017-04-20 16:18:45 -07:00
e1000e e1000e: fix race condition around skb_tstamp_tx() 2017-06-06 00:52:17 -07:00
fm10k fm10k: do not enqueue mailbox when host not ready 2017-04-05 22:47:31 -07:00
i40e i40e/virtchnl: move function to virtchnl 2017-06-01 14:22:53 -07:00
i40evf i40evf: Add support for Adaptive Virtual Function 2017-06-01 14:30:02 -07:00
igb igb: mark PM functions as __maybe_unused 2017-06-06 00:51:36 -07:00
igbvf igbvf: Use net_device_stats from struct net_device 2017-04-20 16:32:45 -07:00
ixgb ixgb: Omit private ndo_get_stats function 2017-04-20 16:18:45 -07:00
ixgbe ixgbe: fix incorrect status check 2017-05-31 04:54:12 -07:00
ixgbevf ixgbevf: Resolve warnings for -Wimplicit-fallthrough 2017-05-31 04:46:44 -07:00
e100.c net/{mii, smsc}: Make mii_ethtool_get_link_ksettings and smc_netdev_get_ecmd return void 2017-06-05 11:00:42 -04:00
Kconfig i40evf: Add support for Adaptive Virtual Function 2017-06-01 14:30:02 -07:00
Makefile fm10k: Add skeletal frame for Intel(R) FM10000 Ethernet Switch Host Interface Driver 2014-09-23 03:59:13 -07:00