From: sashiko-bot@kernel.org
To: vladimir.oltean@nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v5 net 2/4] net: enetc: do not rely on mEMAC hardware frame padding
Date: Thu, 22 Oct 2026 14:54:43 +0000 [thread overview]
Message-ID: <sashiko-outbox-181659@kernel.org> (raw)
In-Reply-To: <20261021145314.1435049-3-vladimir.oltean@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: enetc: unreleased one-step timestamp lock in enetc_start_xmit()
--
commit f785a6d3699d340412051eda6871e1a582901866
Author: vladimir.oltean@nxp.com <vladimir.oltean@nxp.com>
net: enetc: do not rely on mEMAC hardware frame padding
This commit pads transmitted frames to ETH_ZLEN in software using
eth_skb_pad() for non-GSO packets and a shared zero-filled DMA padding
buffer descriptor for short GSO segments.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> index ab4bfefda6c8f..f0f9ba94b4df6 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
[ ... ]
> @@ -1053,6 +1088,9 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb,
> enetc_unlock_mdio();
> }
> } else {
> + if (eth_skb_pad(skb))
> + return NETDEV_TX_OK;
> +
[Severity: High]
Can this leave ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS permanently locked when
eth_skb_pad() fails on a short one-step PTP Sync packet?
At the beginning of enetc_start_xmit() in
drivers/net/ethernet/freescale/enetc/enetc.c, a packet with
ENETC_F_TX_ONESTEP_SYNC_TSTAMP acquires the bit lock:
if (enetc_cb->flag & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
if (test_and_set_bit_lock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS,
&priv->flags)) {
skb_queue_tail(&priv->tx_skbs, skb);
return NETDEV_TX_OK;
}
}
Normally, this bit is only cleared by enetc_tx_onestep_tstamp() after TX
completion schedules priv->tx_onestep_tstamp from enetc_clean_tx_ring():
clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags);
skb = skb_dequeue(&priv->tx_skbs);
if (skb)
enetc_start_xmit(skb, priv->ndev);
An IEEE 802.3 L2 PTPv2 Sync frame is 58 bytes (shorter than ETH_ZLEN) and
enters the non-GSO branch. If eth_skb_pad() fails with -ENOMEM, it frees
the skb and enetc_start_xmit() returns NETDEV_TX_OK without scheduling
priv->tx_onestep_tstamp or clearing ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS.
Because the skb was never queued to the TX ring, enetc_clean_tx_ring()
will never run for it, leaving ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS set and
causing all subsequent one-step Sync skbs to accumulate in priv->tx_skbs
indefinitely. Should eth_skb_pad() be called before acquiring the
ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS lock, or should the failure path
release the lock and kick the work item?
> if (unlikely(skb_shinfo(skb)->nr_frags > priv->max_frags))
> if (unlikely(skb_linearize(skb)))
> goto drop_packet_err;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021145314.1435049-1-vladimir.oltean@nxp.com?part=2
next prev parent reply other threads:[~2026-10-22 14:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 14:53 [PATCH v5 net 0/4] Fix short frame transmission in enetc vladimir.oltean
2026-10-21 14:53 ` [PATCH v5 net 1/4] net: enetc: reserve VLAN extension BDs for software TSO vladimir.oltean
2026-10-25 15:21 ` netdev-bot+sashiko
2026-10-21 14:53 ` [PATCH v5 net 2/4] net: enetc: do not rely on mEMAC hardware frame padding vladimir.oltean
2026-10-22 8:33 ` David Laight
2026-10-22 9:41 ` Vladimir Oltean
2026-10-22 10:22 ` David Laight
2026-10-22 12:35 ` Vladimir Oltean
2026-10-22 20:48 ` David Laight
2026-10-23 9:35 ` Vladimir Oltean
2026-10-22 14:54 ` sashiko-bot [this message]
2026-10-26 8:04 ` Vladimir Oltean
2026-10-25 15:21 ` netdev-bot+sashiko
2026-10-21 14:53 ` [PATCH v5 net 3/4] net: enetc: ensure head buffer has at least 16 octets vladimir.oltean
2026-10-25 15:21 ` netdev-bot+sashiko
2026-10-21 14:53 ` [PATCH v5 net 4/4] net: enetc: pad short XDP frames in software vladimir.oltean
2026-10-25 15:21 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-181659@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox