Article View: linux.kernel.netdev
Article #27500Re: [PATCH net v2 2/6] idpf: ignore Tx timestamp replies once removal has started
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 20:47
Date: Sat, 05 Dec 2026 20:47
132 lines
13244 bytes
13244 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] This patch closes only one of the paths that use the Tx
timestamp trackers after they are freed on remove (and, once the later…
--
idpf: ignore Tx timestamp replies once removal has started
When IDPF_REMOVE_IN_PROG is set, this patch makes idpf_vc_core_deinit()
wait for mbx_task to finish before releasing the PTP state. It then queues
mbx_task again right away, so replies to synchronous transactions are still
handled during vport teardown. It also makes
idpf_ptp_get_tx_tstamp_async_handler() return early once
IDPF_REMOVE_IN_PROG is set.
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index c89783966bae3..348c7875134ad 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3262,8 +3262,18 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
>
> /* Avoid transaction timeouts when called during reset */
> remove_in_prog = test_bit(IDPF_REMOVE_IN_PROG, adapter->flags);
> - if (!remove_in_prog)
> + if (!remove_in_prog) {
> libie_ctlq_xn_shutdown(adapter->xnm);
> + } else {
> + /* The transaction manager stays up for the teardown below, so
> + * async replies can still arrive. Wait for a mailbox task that
> + * may be running an async callback; callbacks that run later
> + * see IDPF_REMOVE_IN_PROG and leave the state released below
> + * alone.
> + */
> + cancel_delayed_work_sync(&adapter->mbx_task);
> + queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
> + }
>
> idpf_ptp_release(adapter);
> idpf_deinit_task(adapter);
[Severity: High]
The mailbox async handler is gated now. Are other users of the Tx
timestamp trackers still live at this point?
idpf_ptp_release() still runs before idpf_deinit_task(). NAPI and xmit for
the vports are stopped only later, in:
idpf_deinit_task()->idpf_vport_dealloc()->idpf_vport_stop()
Neither idpf_remove() nor idpf_shutdown() closes or detaches the netdevs
before this. So the datapath can still be running while
idpf_ptp_release_vport_tstamp() does this:
cancel_work_sync(&vport->tstamp_task);
...
kfree(vport->tx_tstamp_caps);
vport->tx_tstamp_caps = NULL;
Only the vport pointer is cleared. Each txq->cached_tstamp_caps, set in
idpf_vport_init_fast_path_txqs(), still points at the freed object.
On xmit, idpf_tx_tstamp()->idpf_ptp_get_txq_tstamp_capability() reads
txq->cached_tstamp_caps->access. idpf_ptp_request_ts() then does:
spin_lock(&tx_q->cached_tstamp_caps->latches_lock);
head = &tx_q->cached_tstamp_caps->latches_free;
...
Can this take the lock and move list entries in freed memory?
On Tx completion, idpf_tx_clean_bufs() calls idpf_tx_read_tstamp() for an
skb that has SKBTX_IN_PROGRESS set:
tx_tstamp_caps = txq->cached_tstamp_caps;
spin_lock_bh(&tx_tstamp_caps->status_lock);
...
tx_tstamp_status->skb = skb;
tx_tstamp_status->state = IDPF_PTP_REQUEST;
...
queue_work(system_dfl_wq, txq->tstamp_task);
Doesn't this write into the freed tracker? It also queues tstamp_task
again after the only cancel_work_sync().
If tstamp_task runs again, idpf_tstamp_task()->idpf_ptp_get_tx_tstamp()
has no NULL or IDPF_REMOVE_IN_PROG check:
tx_tstamp_caps = vport->tx_tstamp_caps;
head = &tx_tstamp_caps->latches_in_use;
size = struct_size(send_tx_tstamp_msg, tstamp_latches,
tx_tstamp_caps->num_entries);
Would this oops on the NULL tx_tstamp_caps?
Nothing cancels tstamp_task again before
idpf_vport_dealloc()->idpf_vport_rel() frees the vport. Could a late run
also reach the freed vport through container_of()?
The commit message describes the bug as code that "reads
vport->tx_tstamp_caps and takes its lock after
idpf_ptp_release_vport_tstamp() may already have freed it". The new
comment says later callbacks "leave the state released below alone".
The xmit, Tx completion and tstamp_task paths reach the same object in the
same window. The later patch in this series sets IDPF_REMOVE_IN_PROG on
shutdown, so shutdown would be exposed to these paths too. This code is
also unchanged at the end of the series. The order is still
idpf_ptp_release() and then idpf_deinit_task(), cached_tstamp_caps is
never cleared, and idpf_ptp_get_tx_tstamp() has no check.
To trigger this, HW Tx timestamping has to be enabled (SIOCSHWTSTAMP) and
SO_TIMESTAMPING traffic has to be flowing when the device is removed or
shut down.
Would it work better to quiesce Tx first, or to release the trackers only
after idpf_deinit_task() has stopped the vports?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204194642.3048406-1-anthony.l.nguyen%40intel.com
Technical Details
Message-ID:
<179650363113.3148.2771200929909107480@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378123-linux-kernel-netdev=dewy.ruReferences:
<20261204194642.3048406-3-anthony.l.nguyen@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378123-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/6] idpf: ignore Tx timestamp replies once removal has started Date: Sat, 05 Dec 2026 20:47:11 +0000 Organization: Usenet Network Message-ID: <179650363113.3148.2771200929909107480@kernel.org> References: <20261204194642.3048406-3-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3117197"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:j4S3dcZjP3zoHbIeZe1K4y1VQAc= sha256:x0D559HtIPdJUQkku1q3ZJIkkukIeRjEDuuw9CBqLh0= sha1:5hU1l+Uv5tMIQRvXRubNBSJ6Obs= sha256:+gKuEWQxrBOZKjtk7HXNCyWnrFtC8Jm2Qg0CMZ4haAs= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8ADBA117EAD; Sat, 5 Dec 2026 23:47:35 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.539 X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n7O6AFOY447F; Sat, 5 Dec 2026 23:47:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378123-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 326BB117EA0; Sat, 5 Dec 2026 23:47:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 5A4F730DA2; Sat, 5 Dec 2026 20:47:14 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796503633; b=SVYvg3xeM05iRx0gedWvG9YWg/RKG+jNvUinuubkaYKd5a56JqP0szpDatPMvAyhtUDp kQC6jI+3Td+I7UzjgAZJq2zTQ6/z5ZsRY4ezfaaymziMRuT/HR399HKODJOLHLhcMzIJu gh3rMMzNepcs/YtfJn5yPqWKJK0OzmQMmU+IjgfyjbNsu3mtR4VaX5K5ru+SALKcI69fd zXsKgeSmALeMpRPhd9y2cJknXE/HnT0AXjsdG6EihO+FSVwRF5IxyDQpBYKJaONdjAEHK qV4hrW7L46IuzpNJ2F8JpLbEWa6lQdRzxfRp4T1/NkcLZaF5k77bp8rpqT4ere7ooPQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796503633; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=w2mYcC2EBFsblBEE2/AGUwA6J6wGI7smG8t+A77iG6w=; b=wqIMptpHjnNOuSNkWzi5DZGVdaOHBOlasnOr9plmI/9tAiGWup1h/ikjSCrs//MDG1rE mPbyEtKmxdZVsjbcu6ntbgO5u3y+Wk8/aaCpJcAzxXLGC0SgHvO65ALThPURJp0XI2j8H 49PxYtSMYbcTuBjPupmR0e52sTfA9evUX50Ni98uz5/Bq8YrGRFWfBKzf3FU0N5wm29kl tPUXj0AKU3rmlauEtu925le/9IdKIfzEtDGt02B/YxPGrojNkSkVDxtjW0+XAsPpk2qo1 XW4taPoCS+Ygx2KWHiP/Fl6vX1no+ssBzCblmRq/RB3TdAUvR2QSyA0+aGM6B2RyZtQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fXhC2Gyt; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB24D606A335; Sat, 5 Dec 2026 20:47:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fXhC2Gyt X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796503633; b=q3ZrK8V5IhUdJleJdpuNuYDrdfpr1RbMpo9IKXahd4sPMukyfalWt1gSxlXTD0hVi9SS XBYZc55hSmO7T3TR9tFAKZGBzt/lTk/Qwja51caV7pQpI0UDDKctOmXh4YHFlM/bF3ueI OBrcptXAMFVbHIJlBxE1INxJMJBnkpsRwjkJ+guTHipZ0eZlG8/koeS3r0+c8fIjC8Vpp DWa/X95vB3nT6GGFB8UWCfQmXlSB8rTacEWZCzhTtvrbEMGbTw6xjZgZSyWb0jrIVLIfi gq3O9dbPaGg1bzG2eSkRjQo9LsK842Lk4FNk3te5IO/hN9fCDZc2lI9WAK0gRdztUlQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796503633; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=w2mYcC2EBFsblBEE2/AGUwA6J6wGI7smG8t+A77iG6w=; b=QcVNmz3LtUtnPCIqRDEmjT5KmcVDIDtX9CFl5DwyzLboJFyAbSsicOYRd6a2aStypdnj aS9MQS2Y2lJh8J8FVPzHZp0L+TZp82lth3YGlBnLQM1cbUpx/Yp/upkr7NtOZbDPLip7c 2qSKnBIsgfon9Bs+P7oFmLpUY7jTEKleTZCFmWBrMgoTfjOMSOMvlu7Y2asoOabWx4RSr gcLYjXP1nTTvN2iQsClnUN+xHhr76ZlXiEvJzlbmvdl6k4qb8tC/ALwCPgLxlxNoJyFBg 1kR/zDf6i+dRdVODtKGGa/cOXsdkBW4ITN3VeASQ4/LkF0ZLjjctbI75PzvCMqrMGVg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fXhC2Gyt; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D1F606A31F; Sat, 5 Dec 2026 20:47:12 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A02DF1F0092B; Sat, 5 Dec 2026 20:47:11 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796503632; bh=w2mYcC2EBFsblBEE2/AGUwA6J6wGI7smG8t+A77iG6w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=fXhC2Gytvbm2KaRxxIWhd+d0COEn3jeTcSIBo7qSXt1zdz+2Wtzi6+FHgYgBqux/y cK9ZKHU5urSUdpGFwb6AdQ5gxiikHDkbfHoP6syyW/srZEJU7j5RavYfs3FHjR1fXT bS/EHE+cMMx2xNzjGLo5RC/I0dzrE+3J2zP6fpI3EX3zJIPL5H7jrEMAW+5pyGK27K HjQzvHczhs1Amv61ETWgDwlw3KafqFEUgzbKxRhy1+KLgmguqVu1L+jd0Ccpt6AnyH b4PRw7qcY0flJeiclKfxKcQVG81/+pwP5D5x7ppFGXYi+yHR/glgARqnmvIOSurgDR smtYSVaoD+EFw== X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com, netdev@vger.kernel.org, tianxun.ng@bytedance.com, oss.patchbox@gmail.com, luckilystar08@gmail.com, emil.s.tantilov@intel.com, richardcochran@gmail.com, milena.olech@intel.com, konstantin.ilichev@intel.com, stable@vger.kernel.org, Samuel.salin@intel.com X-In-Reply-To: <20261204194642.3048406-3-anthony.l.nguyen@intel.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list