Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Przemek Kitszel" <przemyslaw.kitszel@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net 2/3] ice: lock VF config while changing its MSI-X vector count
Date: Thu, 03 Dec 2026 12:50:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-247787@kernel.org> (raw)
In-Reply-To: <20261202124956.18277-3-przemyslaw.kitszel@intel.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] ice: out-of-bounds write in ice_virt_free_irqs() [1]
--

commit 5bbee42971e00f22a76c9890c04b90f5cccc427d
Author: Przemek Kitszel <przemyslaw.kitszel@intel.com>

ice: lock VF config while changing its MSI-X vector count

This commit acquires vf->cfg_lock in ice_sriov_set_msix_vec_count() to
prevent concurrent VF resets from racing with the VSI rebuild and queue
or interrupt remapping.

> diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
> index c49f48b5ae38c..5916cf7bf914e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_sriov.c
> +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
[ ... ]
> @@ -1012,6 +1017,7 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
>  
>  	vf->first_vector_idx = ice_virt_get_irqs(pf, vf->num_msix);
>  	if (vf->first_vector_idx < 0) {
> +		mutex_unlock(&vf->cfg_lock);
>  		ice_put_vf(vf);
>  		return -EINVAL;
>  	}

[Severity: Critical]
This problem wasn't introduced by this patch, but if ice_vsi_rebuild()
fails after ice_virt_get_irqs() succeeded, can jumping to unroll cause
an out-of-bounds bitmap write in ice_virt_free_irqs() [1]?

The unroll path does not free the newly allocated vectors before calling
ice_virt_get_irqs() again to restore prev_msix.  If the tracker bitmap is
exhausted and that second ice_virt_get_irqs() fails, vf->first_vector_idx
is left set to -ENOENT while the VF remains active.  When SR-IOV is later
disabled, ice_free_vfs() passes the negative vf->first_vector_idx to
ice_virt_free_irqs(), where the u32 index parameter converts it into a
large unsigned offset and bitmap_clear() writes past the end of
pf->virt_irq_tracker.bm:

drivers/net/ethernet/intel/ice/ice_irq.c:ice_virt_free_irqs() {
	bitmap_clear(pf->virt_irq_tracker.bm, index - pf->virt_irq_tracker.base,
		     irqs);
}

[1] https://sashiko.dev/#/bug/linux-2f7f0b58-cb12-4cdb-9375-aab49c0f5d75

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202124956.18277-1-przemyslaw.kitszel@intel.com?part=2

  reply	other threads:[~2026-12-03 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:48 [PATCH net 0/3] ice, devlink: fixes needed for XLVF Przemek Kitszel
2026-12-02 12:48 ` [PATCH net 1/3] ice: move only the valid VF queues on LAG reclaim and reset rebuild Przemek Kitszel
2026-12-02 12:48 ` [PATCH net 2/3] ice: lock VF config while changing its MSI-X vector count Przemek Kitszel
2026-12-03 12:50   ` sashiko-bot [this message]
2026-12-02 12:48 ` [PATCH net 3/3] devlink: make room for many nested instances in a dev message Przemek Kitszel
2026-12-02 12:54 ` [PATCH net 0/3] ice, devlink: fixes needed for XLVF netdev-bot+sinfo

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-247787@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=przemyslaw.kitszel@intel.com \
    --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