Article View: linux.kernel.netdev
Article #27499Re: [PATCH net v2 6/6] idpf: release PTP before freeing vports on the init task error path
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 20:47
Date: Sat, 05 Dec 2026 20:47
134 lines
12923 bytes
12923 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] idpf: Fixes tag cites 1a49cf814fe1 instead of 494565a74502
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch only
closes the PTP aux worker case.
--
idpf: release PTP before freeing vports on the init task error path
This moves idpf_ptp_release() to the start of the unwind_vports error
path in idpf_init_task(), so the PTP aux worker is cancelled before the
vports are freed. That matches the order in idpf_vc_core_deinit(). It
fixes a slab-use-after-free in idpf_ptp_update_cached_phctime().
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index 38cb91beacd07..bf59d63bb7ec8 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1769,6 +1769,8 @@ void idpf_init_task(struct work_struct *work)
> return;
>
> unwind_vports:
> + idpf_ptp_release(adapter);
> +
> if (default_vport) {
> for (index = 0; index < adapter->max_vports; index++) {
> if (adapter->vports[index])
[Severity: Low]
Is the Fixes tag pointing at the right commit?
The trailer cites 1a49cf814fe1 ("idpf: add Tx timestamp flows"). That
commit added idpf_ptp_do_aux_work(), the ptp_schedule_worker() call and
idpf_ptp_update_cached_phctime(). But its version of
idpf_ptp_update_cached_phctime() only updated
adapter->ptp->cached_phc_time and adapter->ptp->cached_phc_jiffies. It
never walked adapter->vports[] or dereferenced a struct idpf_vport.
The idpf_for_each_vport(adapter, vport) loop that reads the freed slot
in the KASAN splat appears to have arrived with 494565a74502 ("idpf: add
support for Rx timestamping"). That is also the commit the preceding
patch in this series cites for a related problem.
There is also a case for 4d792219fe6f ("idpf: fix error handling in the
init_task on load"). That commit put the idpf_ptp_release() call at the
bottom of unwind_vports, after the idpf_vport_dealloc() loop. That is
the placement this patch corrects.
This only affects commit metadata, not the code. Still, the Fixes tag
drives stable backport selection. 1a49cf814fe1 would pull this into
trees where the aux worker never touches vports.
Could you check which commit you consider the root cause? Then update
the trailer to 494565a74502, add 4d792219fe6f, or both.
[ ... ]
> @@ -1782,7 +1784,6 @@ void idpf_init_task(struct work_struct *work)
> cancel_delayed_work_sync(&adapter->serv_task);
> cancel_delayed_work_sync(&adapter->mbx_task);
> }
[Severity: High]
This is a pre-existing issue and was not introduced by this patch. Does
mbx_task still have the same window that this patch closes for the PTP
aux worker?
On this unwind path, mbx_task is cancelled only after the
idpf_vport_dealloc() loop has run, and only when IDPF_HR_DRV_LOAD is set.
idpf_vc_core_deinit() uses a similar order: idpf_deinit_task() frees all
vports before mbx_task is cancelled.
While mbx_task is still running, it can reach:
mbx_task
libie_ctlq_xn_recv()
idpf_recv_event_msg()
idpf_handle_event_link()
The only guard in idpf_handle_event_link() is IDPF_REMOVE_IN_PROG. That
flag is not set on the init task unwind (driver load or after a reset).
It is also not set on a function reset that goes through
idpf_init_hard_reset()->idpf_vc_core_deinit()->idpf_deinit_task(). The
handler then does:
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c:idpf_handle_event_link() {
...
vport = idpf_vid_to_vport(adapter, le32_to_cpu(v2e->vport_id));
...
np = netdev_priv(vport->netdev);
...
vport->link_up = v2e->link_status;
...
}
idpf_vid_to_vport() matches on adapter->vport_ids[], which is not cleared
on dealloc. It returns adapter->vports[i] without holding a lock or using
RCU.
Meanwhile, idpf_vport_dealloc() frees the vport before it clears the
slot:
drivers/net/ethernet/intel/idpf/idpf_lib.c:idpf_vport_dealloc() {
...
idpf_vport_rel(vport); /* ends with kfree(vport) */
adapter->vports[i] = NULL;
...
}
If a VIRTCHNL2_EVENT_LINK_CHANGE is handled while a vport is being freed,
can idpf_handle_event_link() read vport->netdev and write vport->link_up
on the freed idpf_vport?
This is the same pattern the commit message describes for
idpf_ptp_update_cached_phctime(), but through a different worker.
idpf_mac_filter_async_handler() only NULL-checks the returned vport and
does not appear to be affected.
> - idpf_ptp_release(adapter);
>
> clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags);
> }
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204194642.3048406-1-anthony.l.nguyen%40intel.com
Technical Details
Message-ID:
<179650363738.3148.8011419031325451022@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer05.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378127-linux-kernel-netdev=dewy.ruReferences:
<20261204194642.3048406-7-anthony.l.nguyen@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer05.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378127-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 6/6] idpf: release PTP before freeing vports on the init task error path Date: Sat, 05 Dec 2026 20:47:17 +0000 Organization: Usenet Network Message-ID: <179650363738.3148.8011419031325451022@kernel.org> References: <20261204194642.3048406-7-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="3117148"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:F4ErIVvPKD6fFL7IUTCKwStJipk= sha256:e1hE37cot0nHCtXh3ZWL0y+0ZTpQIgowXcUFGF682E0= sha1:9PkpRzH217RUA1nirely4+HuZbI= sha256:g28cSc/iy6GtXo247te4tKwZEXZMB18CWZO28qVUiN8= 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 C5030117EAD; Sat, 5 Dec 2026 23:47:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[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 gdUbORGRJ36n; Sat, 5 Dec 2026 23:47:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-378127-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 4D519117EA5; Sat, 5 Dec 2026 23:47:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 84645603CEE; Sat, 5 Dec 2026 20:47:20 +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=1796503640; b=i+itEOaOiFlvyAtTV7PjvJBYA8wllG+Od5wVsT7xzlqowcYCI0uCq1RyUPyB6lOp+cla mfB1/b8PW64DC7cqTLl/BsxWYayfARdOCQEI5dX6cEtnAmdr8YdsuMfflwHYLXg1rEFRI T7gRqU8yCPRsRbjxM7Ilg1l3P5bkIcI18ZNQZ/muZzORp35N7D5nWff3pwN4Oa3YKJLJW AxV532KemlkkVQNEW6o5QBhiOW2uOhwjv1JcAb7RCLT1c99e8mXq0RQJ1G0ZQB21z0ibQ eqQIjqbjnjqrwkFqYW+S2OoFxGtZUmKJvNuZhq/jl1uqbJy7lBqmZts4jjtWX0qq5QA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796503640; 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=qz38PMY2FyD0I5PTOK3Ziu+04vxAORd+o70CRnBpMDk=; b=yVY3o9b5SK0n/1gRMNeGnFCNDISSQry9VkJ8udKUQvbB0IaZSBIBjk9effO+GLBTUG8R xn20Ouw0h5o0AmZIYL9UHlmDSqkSsKnAT2V3sZZTfb3Dsax6NFssSHdnzK1xrlYiBnjyc /JKzQS5rJWeupoQmVocK1DQIE1BNgWKX6b4CFWdxwQxVvRVBg11pZNCqHG3rngdNvo2Bj XuQSE5fykw2+D2cEjNW4ogGZ/Sr4umkpqAFAEw2gXxCOUsrINaS391H0r6jhYc9N9nara U8X/ughtq1rORlrRGZsYO4+d9qxqgE3+c3UJOuH+9w1V8tmBtplY5U3CbquWKDi4F7Q== 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=PdlpSK5s; 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 0743A606A339; Sat, 5 Dec 2026 20:47:20 +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=PdlpSK5s 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=1796503639; b=jcyRNeTjEfBB9I20PK+g5kv7SX+pkx4PNA+tJTL6d/HIgGzlwIIKSlfEjKuvPFTY5y8n 4cAIhYVUM4S0xoftwwvZ38kLWO/2N2pnrEFDRCekuxl1C8gaX4Ljjc8n8fYq8NNTFzqNO +kf1ZqL+IFSVPoC/uPG4gRL4oX6a3UP/gDThFbudcquIbf/r+EMsdPA3ITJATA9oiYpoA ealo9chXnKz4n8PlkPgba4XIidYrcJBEu/TIJYz27osfNse0wsyG3swst1hm5PKrQMvTq vlEMCruR59lAyh7uAaKzBi13jOZ/nzEzREWiOdq44/6/VrEMeYmNSs9f6BqUsHKPMIg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796503639; 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=qz38PMY2FyD0I5PTOK3Ziu+04vxAORd+o70CRnBpMDk=; b=HwoOVCcivmXHTH69wiRknvnntkJ+6NvjqAbkaZ8/eHnBpZV+yBStZzABT8lSP0D3eOIr YyG4Hi1+ty4Ll1N3BhrC8mkP4g5rEI4BsTBmUuzv8U31bN6jgtfXylC50/8hfMaNFmLMh H7kXRHU7UxX8lqFpwoFQkeBvTlHK3kExSmXGxiyvntz26nh9ujFjq5KaqO6xZOkl/Acst e7+FFw05DNWrbLdvogu4Nv6XvAyJitIc4I2b7uGYvinG2nnBT94dfloZH7LV8gMOWVakS iZHx3JmGEe4fHg9SY8rSzWcg4KjWuyRyWfSJYM/a1ko+YbqS2LCYP6Z6ysA1wodTHQw== 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=PdlpSK5s; 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 27EC2606A322; Sat, 5 Dec 2026 20:47:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC1601F00A07; Sat, 5 Dec 2026 20:47:17 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796503638; bh=qz38PMY2FyD0I5PTOK3Ziu+04vxAORd+o70CRnBpMDk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PdlpSK5sF15NCSYVLQ2lQE6/Sdc2FhxiDCkuaNlW4b0+m2xmpo6RSyP2M9c5asjWF l6elsHXiuq3duSTrBAIVedrwcXAoboyctqabCcRs3bVhX7tTeHNupxjoiaDXPrsMWG 7rIYR1/HBtN4s6hsfQHgeuYJDDwCRGxu5Y8xq701Q2wINzxOX+xvRHxIxnMAxSyDIE NealizNpSLP8q9wIRlvRoU5n1pM7OKLBjdbMIajnmvFcs/7rhnyuWJfYVeHBOMHqgH 0cTKMkGEByzWJNPNA8agmtBKFa0u3xIu2d6YeMEW9b/Wi/XUcIkKH3Oe8eKoNWte2g ZemhC1DmlsX3Q== 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-7-anthony.l.nguyen@intel.com> X-sashiko-severity: Low 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 X-Received-Bytes: 12726