Commit 93845d5f authored by Lendacky, Thomas's avatar Lendacky, Thomas Committed by David S. Miller

amd-xgbe: Add a check for an skb in the timestamp path

Spurious Tx timestamp interrupts can cause an oops in the Tx timestamp
processing function if a Tx timestamp skb is NULL. Add a check to insure
a Tx timestamp skb is present before attempting to use it.
Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3abc7cff
...@@ -1212,6 +1212,10 @@ static void xgbe_tx_tstamp(struct work_struct *work) ...@@ -1212,6 +1212,10 @@ static void xgbe_tx_tstamp(struct work_struct *work)
u64 nsec; u64 nsec;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&pdata->tstamp_lock, flags);
if (!pdata->tx_tstamp_skb)
goto unlock;
if (pdata->tx_tstamp) { if (pdata->tx_tstamp) {
nsec = timecounter_cyc2time(&pdata->tstamp_tc, nsec = timecounter_cyc2time(&pdata->tstamp_tc,
pdata->tx_tstamp); pdata->tx_tstamp);
...@@ -1223,8 +1227,9 @@ static void xgbe_tx_tstamp(struct work_struct *work) ...@@ -1223,8 +1227,9 @@ static void xgbe_tx_tstamp(struct work_struct *work)
dev_kfree_skb_any(pdata->tx_tstamp_skb); dev_kfree_skb_any(pdata->tx_tstamp_skb);
spin_lock_irqsave(&pdata->tstamp_lock, flags);
pdata->tx_tstamp_skb = NULL; pdata->tx_tstamp_skb = NULL;
unlock:
spin_unlock_irqrestore(&pdata->tstamp_lock, flags); spin_unlock_irqrestore(&pdata->tstamp_lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment