From: Jakub Ramaseuski <jramaseu@redhat.com>
To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
intel-wired-lan@lists.osuosl.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
Jakub Ramaseuski <jramaseu@redhat.com>
Subject: [PATCH iwl-next 1/3] ice: release the profile ID on ice_add_prof() error paths
Date: Thu, 26 Nov 2026 13:31:12 +0100 [thread overview]
Message-ID: <20261126123114.893916-2-jramaseu@redhat.com> (raw)
In-Reply-To: <20261126123114.893916-1-jramaseu@redhat.com>
When no profile ID matches the extraction sequence, ice_add_prof()
allocates a new one. If ice_update_fd_swap() or ice_update_prof_masking()
then fails, it returns without freeing the ID, and if allocating the
profile map entry fails, without dropping the reference it took. Either
way the profile ID, a resource of the whole device, is leaked.
Free the ID on the first two paths, and drop the reference on the third
before jumping to err_ice_add_prof.
Fixes: 31ad4e4ee1e4 ("ice: Allocate flow profile")
Fixes: 148beb612031 ("ice: Initialize Flow Director resources")
Fixes: b199dddbd399 ("ice: Support non word aligned input set field")
Signed-off-by: Jakub Ramaseuski <jramaseu@redhat.com>
---
drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
index 2a054d3abd466..6d619eeaf0190 100644
--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
+++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
@@ -3065,14 +3065,18 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
* during Tx.
*/
status = ice_update_fd_swap(hw, prof_id, es);
- if (status)
+ if (status) {
+ ice_free_prof_id(hw, blk, prof_id);
goto err_ice_add_prof;
+ }
} else if (blk == ICE_BLK_FD) {
ice_disable_fd_swap(hw, prof_id);
}
status = ice_update_prof_masking(hw, blk, prof_id, masks);
- if (status)
+ if (status) {
+ ice_free_prof_id(hw, blk, prof_id);
goto err_ice_add_prof;
+ }
/* and write new es */
ice_write_es(hw, blk, prof_id, es, symm);
@@ -3083,6 +3087,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
/* add profile info */
prof = devm_kzalloc_obj(ice_hw_to_dev(hw), *prof);
if (!prof) {
+ ice_prof_dec_ref(hw, blk, prof_id);
status = -ENOMEM;
goto err_ice_add_prof;
}
--
2.56.0
next prev parent reply other threads:[~2026-11-26 12:31 UTC|newest]
Thread overview: 4+ 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 ` Jakub Ramaseuski [this message]
2026-11-26 12:31 ` [PATCH iwl-next 2/3] ice: share default RSS hash profiles " Jakub Ramaseuski
2026-11-26 12:31 ` [PATCH iwl-next 3/3] ice: share all " Jakub Ramaseuski
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=20261126123114.893916-2-jramaseu@redhat.com \
--to=jramaseu@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox