From: sashiko-bot@kernel.org
To: "Linkui Xiao" <xiaolinkui@126.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net v3 2/3] ice: detach the VF representor when ice_start_vfs() fails
Date: Fri, 09 Oct 2026 13:05:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-165587@kernel.org> (raw)
In-Reply-To: <20261008125754.3520773-3-xiaolinkui@126.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: ABBA deadlock between pf->vfs.table_lock, devl_lock, and rtnl_lock
--
commit e31928012cb273c164e36248e1b33c296e805e8d
Author: Linkui Xiao <xiaolinkui@kylinos.cn>
ice: detach the VF representor when ice_start_vfs() fails
This commit modifies the error teardown path of ice_start_vfs() to explicitly
detach the VF representor. This prevents memory leaks, use-after-free
scenarios, and stale configuration states.
> diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
> index bf6410c0d85d4..13d97dbd517c8 100644
> --- a/drivers/net/ethernet/intel/ice/ice_sriov.c
> +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
[ ... ]
> @@ -520,8 +520,27 @@ static int ice_start_vfs(struct ice_pf *pf)
[ ... ]
> + /* Mark the VF disabled before its representor and its VSI go
> + * away, the way ice_free_vfs() does, and take cfg_lock
> + * around it to wait out an ice_reset_vf() already in
> + * progress. pf->state has no ICE_VF_DIS on this path and the
> + * loop leaves ICE_VF_STATE_INIT set, so without the bit a
> + * concurrent ice_reset_vf() would pass ice_is_vf_disabled()
> + * and reach ice_eswitch_update_repr() on a destroyed
> + * representor, or trip WARN_ON(!vsi) in ice_dis_vf_mappings().
> + */
> + mutex_lock(&vf->cfg_lock);
> + set_bit(ICE_VF_STATE_DIS, vf->vf_states);
> + mutex_unlock(&vf->cfg_lock);
> +
> + /* detach outside of cfg_lock, see ice_free_vfs() */
> + ice_eswitch_detach_vf(pf, vf);
[Severity: High]
Does this introduce an ABBA deadlock involving pf->vfs.table_lock, devl_lock,
and rtnl_lock?
ice_start_vfs() runs with pf->vfs.table_lock held. Adding a call to
ice_eswitch_detach_vf() here establishes a lock acquisition order of:
table_lock -> devl_lock (acquired in ice_eswitch_detach_vf) -> rtnl_lock
(acquired via unregister_netdev in ice_repr_rem_vf).
However, there is an opposing lock acquisition order during TC mqprio
configuration:
rtnl_lock (held during ndo_setup_tc) -> devl_lock (acquired in
ice_tear_down_devlink_rate_tree) -> table_lock (acquired right after
devl_lock in ice_tear_down_devlink_rate_tree).
If a user enables SR-IOV, triggering an error in ice_start_vfs(), while
concurrently configuring TC mqprio, could this opposing lock acquisition
order result in a deadlock?
> +
> + mutex_lock(&vf->cfg_lock);
> ice_dis_vf_mappings(vf);
> ice_vf_vsi_release(vf);
> + mutex_unlock(&vf->cfg_lock);
> +
> it_cnt--;
> }
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008125754.3520773-1-xiaolinkui@126.com?part=2
next prev parent reply other threads:[~2026-10-09 13:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 12:57 [PATCH iwl-net v3 0/3] ice: fix VF representor lock ordering and teardown error paths Linkui Xiao
2026-10-08 12:57 ` [PATCH iwl-net v3 1/3] ice: attach and detach VF representors outside of vf->cfg_lock Linkui Xiao
2026-10-09 13:05 ` sashiko-bot
2026-10-10 3:00 ` Linkui Xiao
2026-10-10 14:04 ` Simon Horman
2026-10-12 8:54 ` Linkui Xiao
2026-10-08 12:57 ` [PATCH iwl-net v3 2/3] ice: detach the VF representor when ice_start_vfs() fails Linkui Xiao
2026-10-09 13:05 ` sashiko-bot [this message]
2026-10-10 2:42 ` Linkui Xiao
2026-10-10 14:05 ` Simon Horman
2026-10-08 12:57 ` [PATCH iwl-net v3 3/3] ice: free the VF MSI-X vectors when VF start fails Linkui Xiao
2026-10-10 14:05 ` Simon Horman
2026-10-12 9:04 ` Loktionov, Aleksandr
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-165587@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiaolinkui@126.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.