From: sashiko-bot@kernel.org
To: "Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net v3 4/4] ice: cancel FDIR program timer on VF exit
Date: Thu, 19 Nov 2026 15:54:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-223440@kernel.org> (raw)
In-Reply-To: <20261119152438.3577165-5-aleksandr.loktionov@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ice: live lock and timer re-init in ice_vf_fdir_init() during
VF reset
- [Medium] ice: race with ctrl_vsi IRQ and timer in ice_vf_fdir_exit()
--
commit eec70f4e323b99b19bb5e3e82ec01ada929fa7eb
Author: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
ice: cancel FDIR program timer on VF exit
This commit moves the setup of the VF FDIR timer to ice_vf_fdir_init()
and cancels it with timer_delete_sync() in ice_vf_fdir_exit() before
clearing ICE_VF_FDIR_CTX_VALID.
> diff --git a/drivers/net/ethernet/intel/ice/virt/fdir.c b/drivers/net/ethernet/intel/ice/virt/fdir.c
> index 244da64722713..64824b10a47a4 100644
> --- a/drivers/net/ethernet/intel/ice/virt/fdir.c
> +++ b/drivers/net/ethernet/intel/ice/virt/fdir.c
[ ... ]
> @@ -2454,6 +2453,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
> INIT_LIST_HEAD(&fdir->fdir_rule_list);
>
> spin_lock_init(&fdir->ctx_lock);
> + timer_setup(&fdir->ctx_irq.rx_tmr, ice_vf_fdir_timer, 0);
> fdir->ctx_irq.flags = 0;
> fdir->ctx_done.flags = 0;
> ice_vc_fdir_reset_cnt_all(fdir);
[Severity: Medium]
Can calling timer_setup() and spin_lock_init() in ice_vf_fdir_init()
re-initialize a live timer and spinlock during a VF reset?
In ice_reset_vf() and ice_reset_all_vfs(), ice_vf_fdir_exit() and
ice_vf_fdir_init() run before ice_vf_ctrl_vsi_release() stops the VF
control VSI and frees its interrupt:
drivers/net/ethernet/intel/ice/ice_vf_lib.c:ice_reset_vf() {
...
ice_vf_fdir_exit(vf);
ice_vf_fdir_init(vf);
/* clean VF control VSI when resetting VF since it should be setup
* only when VF creates its first FDIR rule.
*/
if (vf->ctrl_vsi_idx != ICE_NO_VSI)
ice_vf_ctrl_vsi_release(vf);
...
}
If a VF reset occurs while an FDIR programming completion interrupt is in
flight on ctrl_vsi, or while ice_flush_fdir_ctx() is running on another
CPU, those paths can access fdir->ctx_lock and fdir->ctx_irq.rx_tmr at
the same time as ice_vf_fdir_init() resets them:
CPU0 CPU1 (<hardirq>)
ice_reset_vf()
ice_vf_fdir_exit()
ice_vf_fdir_init()
spin_lock_init(&fdir->ctx_lock)
timer_setup(&fdir->ctx_irq.rx_tmr, ...)
ice_vc_fdir_irq_handler()
spin_lock_irqsave(&fdir->ctx_lock, ...)
...
timer_delete(&ctx_irq->rx_tmr)
<-- concurrent timer_setup() / lock init
ice_vf_ctrl_vsi_release()
This can corrupt spinlock, timer_list, or debugobjects state and trigger
lockdep splats.
> @@ -2465,6 +2465,14 @@ void ice_vf_fdir_init(struct ice_vf *vf)
> */
> void ice_vf_fdir_exit(struct ice_vf *vf)
> {
> + unsigned long flags;
> +
> + timer_delete_sync(&vf->fdir.ctx_irq.rx_tmr);
> +
> + spin_lock_irqsave(&vf->fdir.ctx_lock, flags);
> + vf->fdir.ctx_irq.flags &= ~ICE_VF_FDIR_CTX_VALID;
> + spin_unlock_irqrestore(&vf->fdir.ctx_lock, flags);
> +
> ice_vc_fdir_flush_entry(vf);
> idr_destroy(&vf->fdir.fdir_rule_idr);
> ice_vc_fdir_rem_prof_all(vf);
[Severity: Medium]
Can an in-flight ctrl_vsi completion interrupt race with
ice_vf_fdir_exit() when a VF is reset or freed while an FDIR request is
pending?
All callers of ice_vf_fdir_exit() (ice_reset_vf(), ice_reset_all_vfs(),
and ice_free_vf_res()) release ctrl_vsi only after ice_vf_fdir_exit()
returns, so ice_vc_fdir_irq_handler() remains active throughout this
function:
CPU0 CPU1 (<hardirq>)
ice_vf_fdir_exit()
timer_delete_sync(&rx_tmr)
spin_lock_irqsave(&ctx_lock)
ctx_irq.flags &= ~ICE_VF_FDIR_CTX_VALID
spin_unlock_irqrestore(&ctx_lock)
ice_vc_fdir_irq_handler()
spin_lock_irqsave(&ctx_lock)
if (!(ctx_irq->flags &
ICE_VF_FDIR_CTX_VALID))
WARN_ON_ONCE(1); <-- triggers warning
ice_vc_fdir_flush_entry()
...
ice_vf_ctrl_vsi_release()
In addition, if ice_vc_fdir_irq_handler() fires after timer_delete_sync()
deactivates rx_tmr and before ctx_lock is taken to clear
ICE_VF_FDIR_CTX_VALID, timer_delete(&ctx_irq->rx_tmr) returns 0 and logs
"Unexpected inactive timer!". And if either ice_vc_fdir_irq_handler() or
an already-running ice_vf_fdir_timer() callback waited on by
timer_delete_sync() promotes ctx_irq.conf into ctx_done.conf with
ICE_VF_FDIR_CTX_VALID set, ice_vf_fdir_exit() does not clear
ctx_done.flags before ice_vc_fdir_flush_entry() frees conf, leaving a
dangling ctx_done.conf pointer that a concurrent ice_flush_fdir_ctx() can
observe during ice_reset_vf().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119152438.3577165-1-aleksandr.loktionov@intel.com?part=4
prev parent reply other threads:[~2026-11-19 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 14:44 [PATCH iwl-net v2] ice: validate VF FDIR queue and queue region actions Aleksandr Loktionov
2026-10-13 14:58 ` sashiko-bot
2026-11-02 21:09 ` Jacob Keller
2026-11-19 15:24 ` [PATCH iwl-net v3 0/4] ice: validate VF FDIR actions and fix raw flow and timer cleanup Aleksandr Loktionov
2026-11-19 15:24 ` [PATCH iwl-net v3 1/4] ice: free VF FDIR raw flow data with the filter conf Aleksandr Loktionov
2026-11-19 15:24 ` [PATCH iwl-net v3 2/4] ice: validate VF FDIR queue action Aleksandr Loktionov
2026-11-19 15:24 ` [PATCH iwl-net v3 3/4] ice: validate VF FDIR queue region action Aleksandr Loktionov
2026-11-19 15:24 ` [PATCH iwl-net v3 4/4] ice: cancel FDIR program timer on VF exit Aleksandr Loktionov
2026-11-19 15:54 ` sashiko-bot [this message]
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-223440@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
/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