From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v3 net-next 7/8] net: dsa: netc: add PTP two-step timestamping support
Date: Tue, 01 Sep 2026 08:20:26 +0000 [thread overview]
Message-ID: <20260901082026.7F3911F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260831082335.1184605-8-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing NULL check for `tagger_data` in `netc_twostep_tstamp_process` can cause a kernel panic if a packet is received during or after teardown.
--
commit 148461a2244d72398b05dc311c1c2fbd45e48502
Author: Wei Fang <wei.fang@nxp.com>
net: dsa: netc: add PTP two-step timestamping support
This commit adds two-step TX timestamping and RX timestamping for the NETC
switch. It installs ingress port filter table (IPFT) rules for RX and
configures switch tags to capture timestamp responses for the TX path.
> diff --git a/net/dsa/tag_netc.c b/net/dsa/tag_netc.c
> index df72a61796ad5..d46576ae2f751 100644
> --- a/net/dsa/tag_netc.c
> +++ b/net/dsa/tag_netc.c
[ ... ]
> +static void netc_twostep_tstamp_process(struct netc_tag_th_subtype2 *tag,
> + struct sk_buff *skb)
> +{
> + u8 ts_req_id = FIELD_GET(NETC_TAG_TS_REQ_ID, tag->hr_tsreq_id);
> + struct dsa_port *dp = dsa_user_to_port(skb->dev);
> + u64 ts = get_unaligned_be64(&tag->timestamp);
> + struct netc_tagger_data *tagger_data;
> + struct dsa_switch *ds = dp->ds;
> +
> + tagger_data = ds->tagger_data;
> + if (unlikely(!tagger_data->twostep_tstamp_handler))
[Severity: High]
Can tagger_data be NULL here, leading to a kernel panic?
In the DSA teardown sequence (dsa_tree_teardown()),
dsa_switch_teardown_tag_protocol() is called first, invoking
netc_disconnect() which frees ds->tagger_data and sets it to NULL.
However, the conduit device's rx_handler is not removed until
dsa_tree_teardown_conduits() is called later. If a hardware-generated To_Host
subtype 2 response arrives in this window, the conduit's rx_handler will
still invoke netc_rcv(), eventually calling netc_twostep_tstamp_process().
This would result in a NULL pointer dereference when evaluating
!tagger_data->twostep_tstamp_handler.
Note that a follow-up patch (8/8) introduces a similar unchecked dereference
in netc_onestep_sync_enqueue(), so this issue might still be present at the
end of the series.
> + return;
> +
> + tagger_data->twostep_tstamp_handler(ds, dp->index, ts_req_id, ts);
> +}
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831082335.1184605-1-wei.fang@oss.nxp.com?part=7
next prev parent reply other threads:[~2026-09-01 8:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 8:23 [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 1/8] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
2026-09-01 8:20 ` sashiko-bot
2026-09-02 1:56 ` Wei Fang (OSS)
2026-08-31 8:23 ` [PATCH v3 net-next 2/8] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 3/8] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
2026-09-01 8:20 ` sashiko-bot
2026-09-02 2:02 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 4/8] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 5/8] net: dsa: netc: check return value of ntmp_ipft_delete_entry() wei.fang
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 6/8] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 7/8] net: dsa: netc: add PTP two-step timestamping support wei.fang
2026-09-01 8:20 ` sashiko-bot [this message]
2026-09-02 2:12 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 8/8] net: dsa: netc: add PTP one-step " wei.fang
2026-09-01 8:20 ` sashiko-bot
2026-09-02 3:00 ` Wei Fang (OSS)
2026-09-02 3:05 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-09-05 0:52 ` Jakub Kicinski
2026-09-05 6:16 ` Linus Walleij
2026-09-01 15:09 ` [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch Jakub Kicinski
2026-09-02 1:43 ` Wei Fang
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=20260901082026.7F3911F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.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