From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com,
netdev@vger.kernel.org
Cc: Aaron Ma <aaron.ma@canonical.com>,
anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
maciej.machnikowski@intel.com, grzegorz.nitka@intel.com,
jacob.e.keller@intel.com,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Simon Horman <horms@kernel.org>,
Ayush Singh <ayush1x.singh@intel.com>
Subject: [PATCH net 2/5] ice: clear Flow Director entries before reset cleanup
Date: Wed, 25 Nov 2026 14:44:21 -0800 [thread overview]
Message-ID: <20261125224428.4126195-3-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20261125224428.4126195-1-anthony.l.nguyen@intel.com>
From: Aaron Ma <aaron.ma@canonical.com>
Flow Director profiles retain handles to generic flow entries. Reset calls
ice_clear_hw_tbls() to free those entries, but leaves the Flow Director
handles unchanged until replay replaces them.
If rebuild fails before replay completes, later driver removal follows a
stale handle and dereferences a freed flow entry in ice_flow_rem_entry().
KASAN reports a wild access to list poison from
ice_fdir_erase_flow_from_hw().
The failure is reported as:
KASAN: maybe wild-memory-access in range [0xdead000000000108-...]
RIP: ice_flow_rem_entry+0xaf/0x170 [ice]
ice_fdir_erase_flow_from_hw+0x1ee/0x420 [ice]
Clear the Flow Director handles while holding hw->fdir_fltr_lock before
the hardware tables free their entries. A successful replay installs new
handles, while a failed rebuild leaves them invalid for later cleanup.
Fixes: 148beb612031 ("ice: Initialize Flow Director resources")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Ayush Singh <ayush1x.singh@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ice/ice.h | 1 +
.../ethernet/intel/ice/ice_ethtool_ntuple.c | 26 +++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_main.c | 2 ++
3 files changed, 29 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 432da05c48c0..865f299a6ac1 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -1032,6 +1032,7 @@ ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
u32 *rule_locs);
void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx);
void ice_fdir_release_flows(struct ice_hw *hw);
+void ice_fdir_clear_flow_handles(struct ice_hw *hw);
void ice_fdir_replay_flows(struct ice_hw *hw);
void ice_fdir_replay_fltrs(struct ice_pf *pf);
int ice_fdir_create_dflt_rules(struct ice_pf *pf);
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
index 8805f0efe977..3b77a3cf6c64 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
@@ -415,6 +415,32 @@ void ice_fdir_release_flows(struct ice_hw *hw)
ice_fdir_erase_flow_from_hw(hw, ICE_BLK_FD, flow);
}
+/**
+ * ice_fdir_clear_flow_handles - clear handles freed during reset
+ * @hw: pointer to HW instance
+ */
+void ice_fdir_clear_flow_handles(struct ice_hw *hw)
+{
+ int flow;
+
+ if (!hw->fdir_prof)
+ return;
+
+ mutex_lock(&hw->fdir_fltr_lock);
+ for (flow = 0; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+ struct ice_fd_hw_prof *prof = hw->fdir_prof[flow];
+ int tun, i;
+
+ if (!prof)
+ continue;
+
+ for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++)
+ for (i = 0; i < prof->cnt; i++)
+ prof->entry_h[i][tun] = 0;
+ }
+ mutex_unlock(&hw->fdir_fltr_lock);
+}
+
/**
* ice_fdir_replay_flows - replay HW Flow Director filter info
* @hw: pointer to HW instance
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f858473f6f53..706172e149b9 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -601,6 +601,8 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
netif_device_detach(vsi->netdev);
skip:
+ if (hw->fdir_prof)
+ ice_fdir_clear_flow_handles(hw);
/* clear SW filtering DB */
ice_clear_hw_tbls(hw);
/* disable the VSIs and their queues that are not already DOWN */
--
2.47.1
next prev parent reply other threads:[~2026-11-25 22:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
2026-11-25 22:44 ` [PATCH net 1/5] ice: restore DDP state during PFR recovery Tony Nguyen
2026-11-25 22:48 ` netdev-bot+sinfo
2026-11-25 22:44 ` Tony Nguyen [this message]
2026-11-25 22:44 ` [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
2026-11-26 0:03 ` Jacob Keller
2026-11-25 22:44 ` [PATCH net 4/5] ice: remove redundant cross-timestamp PTP command Tony Nguyen
2026-11-25 22:44 ` [PATCH net 5/5] ice: fix computation of ETF timestamps for E830 Tony Nguyen
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=20261125224428.4126195-3-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=aaron.ma@canonical.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=ayush1x.singh@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=grzegorz.nitka@intel.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=maciej.machnikowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=willemb@google.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