summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCliff Spradlin2017-06-19 22:30:43 +0200
committerJeff Kirsher2017-08-09 02:43:18 +0200
commit26bd4e2db06be8a367cba076c6600b4d5c3e65af (patch)
tree66f276c731d252924006295691a1bf0cd16d051b
parentigb: Fix error of RX network flow classification (diff)
downloadkernel-qcow2-linux-26bd4e2db06be8a367cba076c6600b4d5c3e65af.tar.gz
kernel-qcow2-linux-26bd4e2db06be8a367cba076c6600b4d5c3e65af.tar.xz
kernel-qcow2-linux-26bd4e2db06be8a367cba076c6600b4d5c3e65af.zip
igb: protect TX timestamping from API misuse
HW timestamping can only be requested for a packet if the NIC is first setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the igb driver still allowed TX packets to request HW timestamping. In this situation, the _IGB_PTP_TX_IN_PROGRESS flag was set and would never clear. This prevented any future HW timestamping requests to succeed. Fix this by checking that the NIC is configured for HW TX timestamping before accepting a HW TX timestamping request. Signed-off-by: Cliff Spradlin <cspradlin@google.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 6a63ea564a57..5d0a75c1ba0c 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5380,7 +5380,8 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
- if (!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
+ if (adapter->tstamp_config.tx_type & HWTSTAMP_TX_ON &&
+ !test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
&adapter->state)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
tx_flags |= IGB_TX_FLAGS_TSTAMP;