Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jakub Ramaseuski" <jramaseu@redhat.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-next 2/3] ice: share default RSS hash profiles between PFs
Date: Fri, 27 Nov 2026 12:32:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-237409@kernel.org> (raw)
In-Reply-To: <20261126123114.893916-3-jramaseu@redhat.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:
- [High] ice: use-after-free in ice_vc_fdir_rem_prof() during PF reset
  [1]
--

commit 48401f6c29b813715dc1bcf787d7992e20c344db
Author: Jakub Ramaseuski <jramaseu@redhat.com>

ice: share default RSS hash profiles between PFs

This commit tracks shared RSS hash profile IDs in struct ice_adapter so
that multiple PFs on the same device can reuse firmware profile IDs for
default RSS configurations without exhausting the device-wide pool.

> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index 7a56f1367b01c..e59c02e50429c 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -604,6 +604,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
>  		ice_fdir_clear_flow_handles(hw);
>  	/* clear SW filtering DB */
>  	ice_clear_hw_tbls(hw);
> +	/* a CORER, GLOBR or EMPR also clears the profile IDs of the other PFs */
> +	if (reset_type != ICE_RESET_PFR)
> +		ice_flush_shared_profs(hw);
>  	/* disable the VSIs and their queues that are not already DOWN */
>  	set_bit(ICE_VSI_REBUILD_PENDING, ice_get_main_vsi(pf)->state);
>  	ice_pf_dis_all_vsi(pf, false);

[Severity: High]
This problem wasn't introduced by this patch, but can ice_clear_hw_tbls()
here trigger a use-after-free and double free of struct ice_flow_entry in
ice_vc_fdir_rem_prof() during a PF reset [1]?

ice_fdir_clear_flow_handles() clears the PF's cached flow entry handles
before ice_clear_hw_tbls() -> ice_free_flow_profs() frees every profile
and entry in hw->fl_profs[ICE_BLK_FD], but nothing clears the handles
cached by VFs in vf_prof->entry_h:

drivers/net/ethernet/intel/ice/virt/fdir.c:ice_vc_fdir_rem_prof() {
	...
	for (i = 0; i < fdir->prof_entry_cnt[flow][tun]; i++)
		if (vf_prof->entry_h[i][tun]) {
			u16 vsi_num = ice_get_hw_vsi_num(hw, vf_prof->vsi_h[i]);

			ice_rem_prof_id_flow(hw, ICE_BLK_FD, vsi_num, prof_id);
			ice_flow_rem_entry(hw, ICE_BLK_FD,
					   vf_prof->entry_h[i][tun]);
			vf_prof->entry_h[i][tun] = 0;
		}
	...
}

When the reset later runs ice_reset_all_vfs() -> ice_vf_fdir_exit() ->
ice_vc_fdir_rem_prof_all() -> ice_vc_fdir_rem_prof(), those dangling
vf_prof->entry_h pointers are passed to ice_flow_rem_entry(), which
dereferences and frees the struct ice_flow_entry a second time, and the
stale vf_prof->prof_id is passed to ice_flow_rem_prof(), which can remove
a flow profile reallocated during ice_rebuild().

[1] https://sashiko.dev/#/bug/linux-bf11eccc-e91f-476d-9247-5b7368b4b35b

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126123114.893916-1-jramaseu@redhat.com?part=2

  reply	other threads:[~2026-11-27 12:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 12:31 [PATCH iwl-next 0/3] ice: share RSS hash profile IDs between PFs Jakub Ramaseuski
2026-11-26 12:31 ` [PATCH iwl-next 1/3] ice: release the profile ID on ice_add_prof() error paths Jakub Ramaseuski
2026-11-26 12:31 ` [PATCH iwl-next 2/3] ice: share default RSS hash profiles between PFs Jakub Ramaseuski
2026-11-27 12:32   ` sashiko-bot [this message]
2026-11-27 13:39   ` Przemek Kitszel
2026-11-26 12:31 ` [PATCH iwl-next 3/3] ice: share all " Jakub Ramaseuski
2026-11-27 13:45   ` Przemek Kitszel

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-237409@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jramaseu@redhat.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