This is a note to let you know that I've just added the patch titled net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-mscc-ocelot-warn-when-a-ptp-irq-is-raised-for-an-unknown-skb.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9fde506e0c53b8309f69b18b4b8144c544b4b3b1 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean <vladimir.oltean@xxxxxxx> Date: Tue, 12 Oct 2021 14:40:37 +0300 Subject: net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb From: Vladimir Oltean <vladimir.oltean@xxxxxxx> commit 9fde506e0c53b8309f69b18b4b8144c544b4b3b1 upstream. When skb_match is NULL, it means we received a PTP IRQ for a timestamp ID that the kernel has no idea about, since there is no skb in the timestamping queue with that timestamp ID. This is a grave error and not something to just "continue" over. So print a big warning in case this happens. Also, move the check above ocelot_get_hwtimestamp(), there is no point in reading the full 64-bit current PTP time if we're not going to do anything with it anyway for this skb. Fixes: 4e3b0468e6d7 ("net: mscc: PTP Hardware Clock (PHC) support") Signed-off-by: Vladimir Oltean <vladimir.oltean@xxxxxxx> Reviewed-by: Florian Fainelli <f.fainelli@xxxxxxxxx> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/mscc/ocelot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -714,12 +714,12 @@ void ocelot_get_txtstamp(struct ocelot * spin_unlock_irqrestore(&port->tx_skbs.lock, flags); + if (WARN_ON(!skb_match)) + continue; + /* Get the h/w timestamp */ ocelot_get_hwtimestamp(ocelot, &ts); - if (unlikely(!skb_match)) - continue; - /* Set the timestamp into the skb */ memset(&shhwtstamps, 0, sizeof(shhwtstamps)); shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); Patches currently in stable-queue which might be from vladimir.oltean@xxxxxxx are queue-5.14/net-mscc-ocelot-cross-check-the-sequence-id-from-the-timestamp-fifo-with-the-skb-ptp-header.patch queue-5.14/net-mscc-ocelot-make-use-of-all-63-ptp-timestamp-identifiers.patch queue-5.14/net-mscc-ocelot-warn-when-a-ptp-irq-is-raised-for-an-unknown-skb.patch queue-5.14/net-dsa-felix-break-at-first-cpu-port-during-init-and-teardown.patch queue-5.14/net-mscc-ocelot-avoid-overflowing-the-ptp-timestamp-fifo.patch queue-5.14/net-mscc-ocelot-deny-tx-timestamping-of-non-ptp-packets.patch